Set jw player youtube video playback quality(设置 jw player youtube 视频播放质量)
问题描述
我正在使用 jw 播放器播放 youtube 视频,但我需要视频以高清 (720p) 开始播放,我使用以下代码:
I'm using jw player to play youtube videos, but i need for the video to start playing in hd ( 720p ) i use the following code:
<div id="player">
<script>
jwplayer("player").setup({
file: "http://www.youtube.com/watch?v=o8UCI7r1Aqw",
height: "720",
width: "1280"
});
</script>
</div>
<script>
jwplayer('player').onPlay(function() {
jwplayer().setPlaybackQuality('hd720');
});
</script>
但我收到以下错误
回调事件处理程序时出错
There was an error calling back an event handler
这里是我设置的测试播放器.
Here is the test player that i set up.
推荐答案
setPlaybackQuality 不是有效的 API 调用 - http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference
setPlaybackQuality is not a valid API call - http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference
以下是有效质量 API 调用的列表:
Here is a list of valid quality API calls:
Quality
These API calls are used to listen to or update the video quality if multiple quality levels of a video are provided.
getQualityLevels()
Returns an array with quality levels from the player. Each level is an object that contains a label property.
getCurrentQuality()
Returns the index of the currently active quality level.
setCurrentQuality(index)
Change the quality level to the provided index. The index must be within the list provided by getQualityLevels.
onQualityLevels(callback)
Fired when the list of available quality levels is updated. Happens e.g. shortly after a playlist item starts playing. Event attributes:
levels (Array): the full array with new quality levels.
onQualityChange (callback)
Fired when the active quality level is changed. Happens in respons to e.g. a user clicking the controlbar quality menu or a script calling setCurrentQuality. Event attributes:
currentQuality (Number): index of the new quality level in the getQualityLevels() array.
这篇关于设置 jw player youtube 视频播放质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:设置 jw player youtube 视频播放质量
基础教程推荐
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01