Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好 播放视频切换清晰度的时候路径已经传过去了 但是视频没有变化 是需要怎样操作呢 #78

Open
xuemou opened this issue Jan 6, 2021 · 8 comments

Comments

@xuemou
Copy link

xuemou commented Jan 6, 2021

No description provided.

@guoguicheng
Copy link
Owner

要说清楚测试的条件,必要时贴上代码

@xuemou
Copy link
Author

xuemou commented Jan 6, 2021

切换不同的清晰度通过接口拿到不同的路径 再传给videoUrl this.vr.playPanorama(videoUrl, vrTypeLive, options), 在js文件内打印显示路径已经变化 但是视频的清晰度明显没有改变 视频只是卡顿一秒就继续播放了

@guoguicheng
Copy link
Owner

@CuiXu1987
Copy link

参照这个例子 https://github.com/guoguicheng/mxreality.js/blob/master/examples/vr_hls_live_switch.html

你好,这个例子切换HLS是可以的,我换成播放FLV,再切换成FLV就不行了。代码大概是这样的:
vr.playPanorama('http://xxx.flv',vr.resType.flvVideo);
document.getElementById('switch').addEventListener('click', function (e) {
vr.play('http://xxx.flv',
vr.resType.flvVideo, options)
}, false);

@guoguicheng
Copy link
Owner

先vr.destroy()然后在vr.play(...)试试看

@CuiXu1987
Copy link

先vr.destroy()然后在vr.play(...)试试看

嗯,这样做是可以的,就是把整个vr都destroy掉再重建有点麻烦。能不能在vr.play方法中优化一下呢

@guoguicheng
Copy link
Owner

收到反馈,会尽快完成优化

@CuiXu1987
Copy link

收到反馈,会尽快完成优化

我发现flvConfig携带的还有之前的segments,重新初始化flvConfig 就好了

else if (that.resType.flvVideo == resType) {
if (!flvjs.isSupported()) {
console.error('Your browser does not support flvjs')
return;
}
this.flvConfig = {
type: 'flv',
isLive: true,
};
that.flvConfig.url = recUrl;
that.flvPlayer = flvjs.createPlayer(that.flvConfig);
that.flvPlayer.attachMediaElement(video);
that.flvPlayer.load();
that.flvPlayer.play();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants