fix: duration导致的弹幕加载问题 issues #241
This commit is contained in:
@ -338,7 +338,7 @@ class PlPlayerController {
|
|||||||
if (!_listenersInitialized) {
|
if (!_listenersInitialized) {
|
||||||
startListeners();
|
startListeners();
|
||||||
}
|
}
|
||||||
await _initializePlayer(seekTo: seekTo);
|
await _initializePlayer(seekTo: seekTo, duration: _duration.value);
|
||||||
bool autoEnterFullcreen =
|
bool autoEnterFullcreen =
|
||||||
setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
||||||
if (autoEnterFullcreen && _isFirstTime) {
|
if (autoEnterFullcreen && _isFirstTime) {
|
||||||
@ -444,6 +444,7 @@ class PlPlayerController {
|
|||||||
// 开始播放
|
// 开始播放
|
||||||
Future _initializePlayer({
|
Future _initializePlayer({
|
||||||
Duration seekTo = Duration.zero,
|
Duration seekTo = Duration.zero,
|
||||||
|
Duration? duration,
|
||||||
}) async {
|
}) async {
|
||||||
// 设置倍速
|
// 设置倍速
|
||||||
if (videoType.value == 'live') {
|
if (videoType.value == 'live') {
|
||||||
@ -467,7 +468,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 自动播放
|
// 自动播放
|
||||||
if (_autoPlay) {
|
if (_autoPlay) {
|
||||||
await play();
|
await play(duration: duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,6 +597,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
/// 设置倍速
|
/// 设置倍速
|
||||||
Future<void> setPlaybackSpeed(double speed) async {
|
Future<void> setPlaybackSpeed(double speed) async {
|
||||||
|
/// TODO _duration.value丢失
|
||||||
await _videoPlayerController?.setRate(speed);
|
await _videoPlayerController?.setRate(speed);
|
||||||
try {
|
try {
|
||||||
DanmakuOption currentOption = danmakuController!.option;
|
DanmakuOption currentOption = danmakuController!.option;
|
||||||
@ -631,7 +633,9 @@ class PlPlayerController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/// 播放视频
|
/// 播放视频
|
||||||
Future<void> play({bool repeat = false, bool hideControls = true}) async {
|
/// TODO _duration.value丢失
|
||||||
|
Future<void> play(
|
||||||
|
{bool repeat = false, bool hideControls = true, dynamic duration}) async {
|
||||||
// 播放时自动隐藏控制条
|
// 播放时自动隐藏控制条
|
||||||
controls = !hideControls;
|
controls = !hideControls;
|
||||||
// repeat为true,将从头播放
|
// repeat为true,将从头播放
|
||||||
@ -645,6 +649,9 @@ class PlPlayerController {
|
|||||||
|
|
||||||
playerStatus.status.value = PlayerStatus.playing;
|
playerStatus.status.value = PlayerStatus.playing;
|
||||||
// screenManager.setOverlays(false);
|
// screenManager.setOverlays(false);
|
||||||
|
|
||||||
|
/// 临时fix _duration.value丢失
|
||||||
|
_duration.value = duration;
|
||||||
audioSessionHandler.setActive(true);
|
audioSessionHandler.setActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user