fijkplayer
fijkplayer copied to clipboard
如果当前视频正在播放,如何切换视频源 播放下一个用户点击的视频 setDataSource 方法调用了没有反应
我也遇到了这个问题,请问现在解决了吗
要先 reset了才能重新赋值播放源,不知道怎么实现无缝切换
要先 reset了才能重新赋值播放源,不知道怎么实现无缝切换
player.reset(); player.setDataSource(url, autoPlay: true); 用了后 还是无法播放,请问还有其他啥需要注意的吗
FijkPlayer player = map['vc']; player.reset();
String url = '';
if (action.payload['type'] == 0) {
url = map['hls'];
map['quality'] = 0;
} else {
url = map['hlsHd'];
map['quality'] = 1;
}
player.setVolume(0);
player.setDataSource(url, autoPlay: true);
断点看到player的datasource还是之前的地址,不是后来新的地址
要先 reset了才能重新赋值播放源,不知道怎么实现无缝切换
现在不支持无缝切换
要先 reset了才能重新赋值播放源,不知道怎么实现无缝切换
现在不支持无缝切换
啥时候能支持啊
我都是用这句话在reset()之后来让下一个视频继续播放的
await Future.delayed(Duration(seconds: 2)).then((_){ player.setDataSource(url, autoPlay: true); });
我都是用这句话在reset()之后来让下一个视频继续播放的
await Future.delayed(Duration(seconds: 2)).then((_){ player.setDataSource(url, autoPlay: true); });
你这不行。不reset 直接调用setDataSource 不行的
Future<void> _setVideoSource(String path) async {
try {
await _player.reset();
_player.removeListener(_onPlayerValueChanged);
await _player.setDataSource(path, autoPlay: true);
_player.addListener(_onPlayerValueChanged);
} catch (e) {
Log.error('$e');
}
}
It works perfectly -- for me.
Future<void> _setVideoSource(String path) async { try { await _player.reset(); _player.removeListener(_onPlayerValueChanged); await _player.setDataSource(path, autoPlay: true); _player.addListener(_onPlayerValueChanged); } catch (e) { Log.error('$e'); } }
It works perfectly -- for me.
Only your answer is the most accurate. This is indeed caused by the asynchronous mechanism.