I want to sort local files into different groups, such as video group, audio group, pdf group, here is my code:
Widget mainContent({int index, CardContentController controller}) {
return GetBuilder<CardContentController>(builder: (controller) {
if (controller.contentList[index].contentUrl.contains('mp4')) // <- here is my question
{ return buildMainContentWidget(index, videoWidget(index, controller),
onTap: () {
openFullscreen(index: index, controller: controller);
});
} else if (controller.contentList[index].contentUrl.contains('jpg') ||
controller.contentList[index].contentUrl.contains('jpeg') ||
controller.contentList[index].contentUrl.contains('png')) {
return buildMainContentWidget(index, imageWidget(index, controller),
onTap: () {
});
} else if (controller.contentList[index].contentUrl.contains('aac') ||
controller.contentList[index].contentUrl.contains('wav') ||
controller.contentList[index].contentUrl.contains('mp3') ||
controller.contentList[index].contentUrl.contains('ogg')) {
return buildMainContentWidget(index, audioWidget(index, controller),
onTap: () {
});
}
return Container(
height: Get.height * 0.5,
width: Get.width,
color: Colors.green,
child: Center(
child: Text(
'Wrong document.'.tr,
style: mediumTextStyle(textColor: Colors.red),
),
),
);
});
}
I checked doc from package video_player,
Supported Formats
On iOS, the backing player is AVPlayer. The supported formats vary depending on the version of iOS, AVURLAsset class has audiovisualTypes that you can query for supported av formats.
On Android, the backing player is ExoPlayer, please refer here for list of supported formats.
On Web, available formats depend on your users' browsers (vendor and version). Check package:video_player_web for more specific information.
So for android and ios there will be different supported formats which are much more than 'mp4'
, could you plz help me complete my code to support all video formats based on OS, thank you!