我的问题是,在视频播放期间改变质量。
当我在 onReady 事件函数中使用 setPlaybackQuality 时,质量已更改,但在视频播放期间无法实现。
虽然 onPlaybackQualityChange 事件返回我想要的质量,但事实上并没有改变视频质量。
player[playaID] = new YT.Player('content_'+playaID, {
height: playaHeight,
width: playaWidth,
videoId: playaVID,
playerVars: {
'autoplay':0,
'controls':0,
'showinfo':0,
'fs': 1,
'rel': 1,
'modestbranding':0
},
events: {
'onReady': onPlayerReady(playaID),
'onStateChange':onPlayerStateChange(playaID,event),
'onPlaybackQualityChange':onPlayerQualityChange(playaID,event)
}
});
答案 0 :(得分:1)
SOLLUTION:
如果您想在视频播放期间改变质量:
1:你必须停止视频播放器.stopVideo()
2:设置质量 - player.setPlaybackQuality(' hd720')
3:播放视频 - player.playVideo()
低于是我的设定质量的功能。
var setQuality=function(playaID,q){
var curSeek = player[playaID].getCurrentTime(); // current video time
var status = player[playaID].getPlayerState(); // video status
if(status!=-1 && status!=5){ // if not started, does not to be stoped
player[playaID].stopVide();
}
player[playaID].setPlaybackQuality(q);
player[playaID].seekTo(curSeek);
if(status!=1){
player[playaID].paseVideo(); // if was paused
}else{
player[playaID].playVideo(); // if was playing
}
}