LeGoffMael / video_editor

A flutter package for editing video written in pure Dart with fully customizable UI. Supports crop, trim, rotation and cover selection.
https://pub.dev/packages/video_editor
MIT License
385 stars 227 forks source link

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

Open duchoang2206 opened 10 months ago

duchoang2206 commented 10 months ago

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 commented 9 months ago

It still doesn't work.

mcosti commented 9 months ago

Same here

t3chno commented 3 months ago

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

frosterlolz commented 19 hours ago

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