我做了 RTMP 流媒体,它对我来说工作正常,但现在客户端需要 HLS 流媒体,这是我的 RTMP 流媒体代码
var playerInstance = jwplayer("containerForShortVideo");
playerInstance.setup({
image: "' .Main_VideoUrl(ImagesUrl($VideoDetails[0])) /*S3_VIDEO_BUCKETABSOLUTE_PATH . $VideoDetails[0]['ImageName']*/ . '",
autostart: false,
sources: [
{
file: "' . S3_VIDEO_BUCKETABSOLUTE_PATH . $highResolutionURL . '",
label: "1080p",
type: "mp4"
},
{
file: "' . S3_VIDEO_BUCKETABSOLUTE_PATH . $VideoDetails[0]['VideoStreamURL'] . '",
label: "480p",
type: "mp4"
},
{
file: "' . S3_VIDEO_BUCKETABSOLUTE_PATH . $mediumResolutionURL . '",
label: "360p",
default: "true",
type: "mp4"
},
{
file: "' . S3_VIDEO_BUCKETABSOLUTE_PATH . $lowResolutionURL . '",
label: "240p",
type: "mp4"
}
],
advertising: {
client: "vast",
schedule: {
adbreak1: {
offset: "pre",
tag: "'.$adurl1.'",
},
adbreak2: {
offset:"'.$adurmidtime.'",
tag: "'.$adurl2.'",
},
adbreak3: {
offset: "post",
tag: "'.$adurl3.'",
},
}
}
});
任何人都可以告诉我如何将其转换为 HLS 流媒体?
JW Player 无法为您转换视频 - 您需要在媒体服务器上执行此操作,可能是您从任何服务器获取视频。也许该服务器上已经有该视频的HLS版本(它将以"/playlist.m3u8"结尾。
如果你想用JWPlayer玩HLS,只需在你的页面上添加一些东西:
<script type="text/javascript">
jwplayer.key = "hh456456FDGDFGDFGFDGFdasfsdf";
jwplayer("video_player").setup({
file: "http://myserver/file.m3u8",
image: "http://myserver/mycoverimage.jpg",
width: "100%",
aspectratio: "16:9",
androidhls: true,
autostart: true,
fallback: true,
wprimary: 'flash',
}).onSetupError(function (error) {
console.log(error);
});
</script>