Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't load videos which have extension mp4 (iOS) #172

Open
duchoang2206 opened this issue Nov 17, 2023 · 4 comments
Open

I can't load videos which have extension mp4 (iOS) #172

duchoang2206 opened this issue Nov 17, 2023 · 4 comments

Comments

@duchoang2206
Copy link

duchoang2206 commented Nov 17, 2023

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.

@duchoang2206 duchoang2206 changed the title I can't load videos which have extension mp4 I can't load videos which have extension mp4 (iOS) Nov 17, 2023
@duchoang2206 duchoang2206 reopened this Nov 27, 2023
@duchoang2206
Copy link
Author

It still doesn't work.

@mcosti
Copy link

mcosti commented Dec 14, 2023

Same here

@t3chno
Copy link

t3chno commented May 26, 2024

same here, not initializing at all on iOS. anybody has a solution?

@frosterlolz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants