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 {
String dataSource = item.mediaIdentifier;
int startTime = item.position;
List<String> videoParams = [
VlcVideoOptions.dropLateFrames(false),
VlcVideoOptions.skipFrames(false),
];
List<String> advancedParams = [
'--start-time=$startTime',
VlcAdvancedOptions.networkCaching(20000),
];
List<String> soutParams = [
'--start-time=$startTime',
VlcStreamOutputOptions.soutMuxCaching(20000),
];
List<String> audioParams = [
'--audio-language=${appModel.targetLanguage.languageCode},${appModel.appLocale.languageCode}',
'--sub-track=99999',
if (appModel.playerUseOpenSLES) '--aout=opensles',
];
return VlcPlayerController.network(
dataSource,
hwAcc: appModel.playerHardwareAcceleration ? HwAcc.auto : HwAcc.disabled,
options: VlcPlayerOptions(
advanced: VlcAdvancedOptions(advancedParams),
audio: VlcAudioOptions(audioParams),
sout: VlcStreamOutputOptions(soutParams),
video: VlcVideoOptions(videoParams),
),
);
}