Skip to content

Commit

Permalink
fix(video player): video player memory leak (#153)
Browse files Browse the repository at this point in the history
MiaoMint authored Dec 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 296a9a5 commit b090bbb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/controllers/watch/video_controller.dart
Original file line number Diff line number Diff line change
@@ -78,13 +78,21 @@ class VideoPlayerController extends GetxController {
// 复制当前 context

@override
void onInit() {
void onInit() async {
if (Platform.isAndroid) {
// 切换到横屏
SystemChrome.setPreferredOrientations(
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
}

if (player.platform is NativePlayer) {
await (player.platform as dynamic).setProperty('cache', 'yes');
await (player.platform as dynamic)
.setProperty('demuxer-readahead-secs', '20');
await (player.platform as dynamic)
.setProperty('demuxer-max-bytes', '30MiB');
}
play();

// 切换剧集

0 comments on commit b090bbb

Please sign in to comment.