提交 4b10d489 authored 作者: kongdywang's avatar kongdywang

1. player widget support webRTC playback

2. fix video offline download videoQualityId's range error
上级 7db2b9ce
...@@ -15,7 +15,7 @@ class CommonUtils { ...@@ -15,7 +15,7 @@ class CommonUtils {
cacheQualityIndex = DownloadQuality.QUALITY_480P; cacheQualityIndex = DownloadQuality.QUALITY_480P;
} else if (minValue > 480 && minValue <= 540) { } else if (minValue > 480 && minValue <= 540) {
cacheQualityIndex = DownloadQuality.QUALITY_540P; cacheQualityIndex = DownloadQuality.QUALITY_540P;
} else if (minValue > 540 && minValue >= 720) { } else if (minValue > 540 && minValue <= 720) {
cacheQualityIndex = DownloadQuality.QUALITY_720P; cacheQualityIndex = DownloadQuality.QUALITY_720P;
} else if (minValue > 720 && minValue <= 1080) { } else if (minValue > 720 && minValue <= 1080) {
cacheQualityIndex = DownloadQuality.QUALITY_1080P; cacheQualityIndex = DownloadQuality.QUALITY_1080P;
......
...@@ -393,7 +393,7 @@ class SuperPlayerController { ...@@ -393,7 +393,7 @@ class SuperPlayerController {
_observer?.onError(SuperPlayerCode.PLAY_URL_EMPTY, FSPLocal.current.txSpwErrEmptyUrl); _observer?.onError(SuperPlayerCode.PLAY_URL_EMPTY, FSPLocal.current.txSpwErrEmptyUrl);
return; return;
} }
if (_isRTMPPlay(videoUrl)) { if (_isRTMPPlay(videoUrl) || _isWebRtcPlay(videoUrl)) {
_playLiveURL(videoUrl, TXPlayType.LIVE_RTMP); _playLiveURL(videoUrl, TXPlayType.LIVE_RTMP);
} else if (_isFLVPlay(videoUrl)) { } else if (_isFLVPlay(videoUrl)) {
_playTimeShiftLiveURL(model.appId, videoUrl); _playTimeShiftLiveURL(model.appId, videoUrl);
...@@ -403,7 +403,7 @@ class SuperPlayerController { ...@@ -403,7 +403,7 @@ class SuperPlayerController {
} else { } else {
_playVodUrl(videoUrl); _playVodUrl(videoUrl);
} }
bool isLivePlay = (_isRTMPPlay(videoUrl) || _isFLVPlay(videoUrl)); bool isLivePlay = (_isRTMPPlay(videoUrl) || _isFLVPlay(videoUrl) || _isWebRtcPlay(videoUrl));
_observer?.onPlayProgress(0, model.duration.toDouble(), 0); _observer?.onPlayProgress(0, model.duration.toDouble(), 0);
_updatePlayerType(isLivePlay ? SuperPlayerType.LIVE : SuperPlayerType.VOD); _updatePlayerType(isLivePlay ? SuperPlayerType.LIVE : SuperPlayerType.VOD);
_updateVideoQualityList(videoQualities, defaultVideoQuality); _updateVideoQualityList(videoQualities, defaultVideoQuality);
...@@ -490,7 +490,7 @@ class SuperPlayerController { ...@@ -490,7 +490,7 @@ class SuperPlayerController {
/// 重新开始播放视频 /// 重新开始播放视频
Future<void> reStart() async { Future<void> reStart() async {
if (playerType == SuperPlayerType.LIVE || playerType == SuperPlayerType.LIVE_SHIFT) { if (playerType == SuperPlayerType.LIVE || playerType == SuperPlayerType.LIVE_SHIFT) {
if (_isRTMPPlay(_currentPlayUrl)) { if (_isRTMPPlay(_currentPlayUrl) || _isWebRtcPlay(_currentPlayUrl)) {
_playLiveURL(_currentPlayUrl, TXPlayType.LIVE_RTMP); _playLiveURL(_currentPlayUrl, TXPlayType.LIVE_RTMP);
} else if (_isFLVPlay(_currentPlayUrl) && null != videoModel) { } else if (_isFLVPlay(_currentPlayUrl) && null != videoModel) {
_playTimeShiftLiveURL(videoModel!.appId, _currentPlayUrl); _playTimeShiftLiveURL(videoModel!.appId, _currentPlayUrl);
...@@ -622,6 +622,12 @@ class SuperPlayerController { ...@@ -622,6 +622,12 @@ class SuperPlayerController {
} }
} }
/// whether it is the webrtc protocol
/// 是否是webrtc协议
bool _isWebRtcPlay(String? videoURL) {
return null != videoURL && videoURL.startsWith("webrtc");
}
/// whether it is the RTMP protocol /// whether it is the RTMP protocol
/// 是否是RTMP协议 /// 是否是RTMP协议
bool _isRTMPPlay(String? videoURL) { bool _isRTMPPlay(String? videoURL) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论