JW Player加载功能多品质

JW Player load function with multiple quality

我设置了jw player这样的品质。

sources: [
            {
                "file":"url_of_video.mp4", 
                "label":"1080p", 
                "type": "mp4",
            },
            {
                "file":"url_of_video.mp4", 
                "label":"720p", 
                "type": "mp4",
            },
            {
                "file":"url_of_video.mp4", 
                "label":"480p", 
                "type": "mp4",
                "default": "true"
            },
            {
                "file":"url_of_video.mp4", 
                "label":"360p", 
                "type": "mp4",
            }

        ]

我想像 jwplayer 开发者网站上提到的那样更改具有加载功能的视频源。

jwplayer('myElement').load([{
    "file": "/videos/myVideo.mp4",
    "image": "/images/myImage.png",
    "title": "My Favorite Video!",
    "description": "This has lots of kittens in it!"
}]);

但在所有示例中只有 1 个视频 url。我试图用 sources 数组替换 "file" 字符串,但它没有用。是否有其他功能可以执行此操作或正确的语法是什么。 非常感谢。

将第二个代码示例中的一个文件:“”参数替换为来源:[] 块,它应该可以工作:

jwplayer('your_div').setup({
    sources: [{
        file: 'video 1 URL'
        label: 'video 1 quality'
    },{
        file: 'video 2 URL'
        label: 'video 2 quality'
    },{
        file: 'video 3 URL'
        label: 'video 3 quality'    
    }]
});

详情请见https://support.jwplayer.com/customer/en/portal/articles/1428524-hd-quality-toggling