Open duchoang2206 opened 10 months ago
It still doesn't work.
Same here
same here, not initializing at all on iOS. anybody has a solution?
This code from controller broke video player controller loading:
_video = VideoPlayerController.file(File(
// https://github.com/flutter/flutter/issues/40429#issuecomment-549746165
Platform.isIOS ? Uri.encodeFull(file.path) : file.path,
)),
VideoPlayerController will loading permanently (cause of listener inside). To fix this I had to store picked file in another place (cache for me) and rename filename. Something like this:
static Future<io.File?> saveToCache(
io.File file, {
String? forceFileName,
}) async {
final cacheDir = await getCachePath();
if (cacheDir == null) return null;
final updatedFileName =
'${forceFileName ?? basenameWithoutExtension(file.path)}.${extension(file.path)}';
final cachedFile = await file.copy('$cacheDir/$updatedFileName');
return cachedFile;
}
then initialize controller with new file *dont forget to delete cached file after complete
I load videos which have extension mp4 then I waited too long for controller's intialization, it's nothing happened. I can't do anything. But I can do it success with files which have extension MOV. Please check this! This happens only on iOS. Thank you.