bug fixes
This commit is contained in:
parent
a7c0fcf6f0
commit
7f615280ac
|
|
@ -24,6 +24,14 @@ class _StudioDetailsState extends State<StudioDetails> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_betterPlayerController = BetterPlayerController(
|
||||
const BetterPlayerConfiguration(
|
||||
aspectRatio: 16 / 9,
|
||||
showPlaceholderUntilPlay: true,
|
||||
autoDispose: false,
|
||||
fullScreenAspectRatio: 16 / 9,
|
||||
),
|
||||
);
|
||||
final state = context.read<StudioDetailsState>();
|
||||
state.args = widget.pageData['args'];
|
||||
Future.delayed(
|
||||
|
|
@ -48,30 +56,7 @@ class _StudioDetailsState extends State<StudioDetails> {
|
|||
},
|
||||
builder: (context, state) {
|
||||
if (_currentlyPlayingId != state.studio.id) {
|
||||
BetterPlayerDataSource betterPlayerDataSource =
|
||||
BetterPlayerDataSource(
|
||||
BetterPlayerDataSourceType.network,
|
||||
state.studio.link,
|
||||
);
|
||||
_betterPlayerController = BetterPlayerController(
|
||||
BetterPlayerConfiguration(
|
||||
aspectRatio: 16 / 9,
|
||||
showPlaceholderUntilPlay: true,
|
||||
controlsConfiguration: BetterPlayerControlsConfiguration(
|
||||
enablePlaybackSpeed: false,
|
||||
enableSubtitles: false,
|
||||
enableAudioTracks: false,
|
||||
progressBarPlayedColor:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
progressBarHandleColor:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
fit: BoxFit.contain,
|
||||
fullScreenAspectRatio: 16 / 9,
|
||||
),
|
||||
betterPlayerDataSource: betterPlayerDataSource,
|
||||
);
|
||||
_currentlyPlayingId = state.studio.id;
|
||||
_handleVideoPlayback(state);
|
||||
}
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
|
|
@ -127,9 +112,29 @@ class _StudioDetailsState extends State<StudioDetails> {
|
|||
);
|
||||
}
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _betterPlayerController.dispose();
|
||||
// super.dispose();
|
||||
// }
|
||||
Future<void> _handleVideoPlayback(state) async {
|
||||
final betterPlayerDataSource = BetterPlayerDataSource(
|
||||
BetterPlayerDataSourceType.network,
|
||||
state.studio.link,
|
||||
);
|
||||
await _betterPlayerController.clearCache();
|
||||
await _betterPlayerController.setupDataSource(betterPlayerDataSource);
|
||||
_betterPlayerController.setBetterPlayerControlsConfiguration(
|
||||
BetterPlayerControlsConfiguration(
|
||||
enablePlaybackSpeed: false,
|
||||
enableSubtitles: false,
|
||||
enableAudioTracks: false,
|
||||
progressBarPlayedColor: Theme.of(context).colorScheme.secondary,
|
||||
progressBarHandleColor: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
);
|
||||
_currentlyPlayingId = state.studio.id;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_betterPlayerController.pause();
|
||||
_betterPlayerController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue