preparePlayerController method
override
Get the player controller to be used when a media item is loaded up,
Implementation
@override
Future<VlcPlayerController> preparePlayerController({
required AppModel appModel,
required WidgetRef ref,
required MediaItem item,
}) async {
int startTime = item.position;
if (item.duration - item.position < 60) {
startTime = 0;
}
List<String> videoParams = [
VlcVideoOptions.dropLateFrames(false),
VlcVideoOptions.skipFrames(false),
];
List<String> advancedParams = [
'--start-time=$startTime',
VlcAdvancedOptions.networkCaching(10000),
];
List<String> soutParams = [
'--start-time=$startTime',
VlcStreamOutputOptions.soutMuxCaching(10000),
];
List<String> audioParams = [
'--audio-language=${appModel.targetLanguage.languageCode},${appModel.appLocale.languageCode}',
'--sub-track=99999',
if (appModel.playerUseOpenSLES) '--aout=opensles'
];
return VlcPlayerController.file(
File(item.mediaIdentifier),
hwAcc: appModel.playerHardwareAcceleration ? HwAcc.auto : HwAcc.disabled,
options: VlcPlayerOptions(
advanced: VlcAdvancedOptions(advancedParams),
audio: VlcAudioOptions(audioParams),
sout: VlcStreamOutputOptions(soutParams),
video: VlcVideoOptions(videoParams),
),
);
}