Code Monkey home page Code Monkey logo

Comments (13)

darshankawar avatar darshankawar commented on June 10, 2024

Thanks for the report @stephane-archer
I tried a sample text file with plugin's example with which I received below log:

Caused by: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor) could read the stream.
E/ExoPlayerImplInternal(29974):       at com.google.android.exoplayer2.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:92)
E/ExoPlayerImplInternal(29974):       at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1017)
E/ExoPlayerImplInternal(29974):       at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
E/ExoPlayerImplInternal(29974):       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/ExoPlayerImplInternal(29974):       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
E/ExoPlayerImplInternal(29974):       at java.lang.Thread.run(Thread.java:1012)
E/flutter (29974): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)
E/flutter (29974): 

Do you see same exception ? It does throw .UnrecognizedInputFormatException which seem to be expected as the file passed is non-video file.

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024

@darshankawar I don't see any exception on MacOS. await controller.initialize(); never finish.
You should probably do the same test on MacOS

from flutter.

darshankawar avatar darshankawar commented on June 10, 2024

I tried plugin example and ran (basic.dart) on desktop and used below sample non-video file which gave me below exception:

https://example-files.online-convert.com/document/txt/example.txt',

https://github.com/flutter/packages/blob/f4719ca2feffe9831c42371488f179b438a1cdf8/packages/video_player/video_player/example/lib/basic.dart#L30

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(VideoError, Failed to load video: Operation Stopped, null, null)

Does it represent your case ?

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024

no, await controller.initialize(); never return, throw, or finish in any way. the code is just blocked here forever.
I think this should at least timeout.

Screenshot 2024-05-04 at 00 13 35 Screenshot 2024-05-04 at 00 13 38 Screenshot 2024-05-04 at 00 13 40 Screenshot 2024-05-04 at 00 13 51

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024

in this case, the file is: "/Volumes/Macintosh HD/Users/fractale/Desktop/proxy_research/benchmarktorun.fish"
it has execution permission and the content is:

#!/usr/bin/env fish
# ffmpeg -i a.mov -vcodec prores_ks -profile:v 0 -vf scale=-1:540 btmp.mov
hyperfine --warmup 5  --prepare 'rm btmp.mov || true' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 0 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 1 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 2 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 3 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 4 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 5 -vf scale=-1:540 btmp.mov'

from flutter.

darshankawar avatar darshankawar commented on June 10, 2024

Thanks for the update. Keeping the issue open for tracking.

from flutter.

navaronbracke avatar navaronbracke commented on June 10, 2024

I cannot reproduce the hang with the sample file. Instead I get the following:

PlatformException(VideoError, Failed to load video: The file couldn’t be opened because you don’t have permission to view it., null, null)
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  VideoPlayerController? _controller;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          child: const Text('Press me'),
          onPressed: () async {
            final File file = File('/Users/navaronbracke/Desktop/video_player_bug/sample.fish');
            _controller = VideoPlayerController.file(file);

            try {
              // Added the timeout to test our theory.
              await _controller?.initialize().timeout(const Duration(seconds: 10));
            } catch (error, stacktrace) {
              print(error);
              print(stacktrace);
            }
          },
        ),
      ),
    );
  }

  @override
  Future<void> dispose() async {
    super.dispose();

    await _controller?.dispose();
  }
}

The file I have set up is the same as @stephane-archer his sample file:

navaronbracke@MacBook-Pro-van-Navaron video_player_bug % stat sample.fish    
16777224 83242391 -rwxrwxrwx 1 navaronbracke staff 0 600 "May  6 11:08:52 2024" "May  6 11:08:35 2024" "May  6 11:19:05 2024" "May  6 11:08:35 2024" 4096 8 0 sample.fish
navaronbracke@MacBook-Pro-van-Navaron video_player_bug % cat sample.fish
#!/usr/bin/env fish
# ffmpeg -i a.mov -vcodec prores_ks -profile:v 0 -vf scale=-1:540 btmp.mov
hyperfine --warmup 5  --prepare 'rm btmp.mov || true' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 0 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 1 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 2 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 3 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 4 -vf scale=-1:540 btmp.mov' 'ffmpeg -i a.mov -vcodec prores_ks -profile:v 5 -vf scale=-1:540 btmp.mov'

I used video_player 2.8.6 and video_player_avfoundation 2.5.7 on MacOS.

[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-x64, locale en-BE)
    • Flutter version 3.19.6 on channel stable at /Users/navaronbracke/Documents/flutter
    • Upstream repository [email protected]:navaronbracke/flutter.git
    • FLUTTER_GIT_URL = [email protected]:navaronbracke/flutter.git
    • Framework revision 54e66469a9 (3 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/navaronbracke/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/navaronbracke/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.89.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.88.0

[✓] Connected device (3 available)
    • motorola one (mobile) • ZL5228NFL7 • android-arm64  • Android 10 (API 29)
    • macOS (desktop)       • macos      • darwin-x64     • macOS 14.4.1 23E224 darwin-x64
    • Chrome (web)          • chrome     • web-javascript • Google Chrome 124.0.6367.119

[✓] Network resources
    • All expected network resources are available.

• No issues found!

from flutter.

stuartmorgan avatar stuartmorgan commented on June 10, 2024

I cannot reproduce the hang with the sample file. Instead I get the following

That may indicate that you don't have the necessary file-read permissions on your app, which would be unrelated.

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024

I'm not sure why you don't observe the same behavior. I clearly have read, write and execution permission on that file.
You can see from the screenshots that the function never return.
No exception, no return value.
Don't you think this function should timeout if this behavior is observed ?

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024

I ran @navaronbracke sample, you can see the code timeout:

Screenshot 2024-05-13 at 12 13 51 Screenshot 2024-05-13 at 12 13 54 Screenshot 2024-05-13 at 12 13 57 Screenshot 2024-05-13 at 12 14 04 Screenshot 2024-05-13 at 12 14 09 Screenshot 2024-05-13 at 12 14 11 Screenshot 2024-05-13 at 12 14 12 Screenshot 2024-05-13 at 12 14 21 Screenshot 2024-05-13 at 12 14 23 Screenshot 2024-05-13 at 12 14 26
-rwxr--r--  1 fractale  staff   599B May  1 16:53 benchmarktorun.fish

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024
[✓] Flutter (Channel stable, 3.19.6, on macOS 13.4.1 22F770820d darwin-x64, locale en-GB)
    • Flutter version 3.19.6 on channel stable at /Users/fractale/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (4 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/fractale/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.89.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.4.1 22F770820d darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 124.0.6367.158

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

from flutter.

stuartmorgan avatar stuartmorgan commented on June 10, 2024

Currently the way the plugin is designed, initialize completion is driven by event channel callbacks rather than an async method channel response, which makes it easy to never resolve the callback. It looks like what happens here is probably than we send an error event to the stream, but never associate it with initialize.

In the short term we could potentially work around it with a new event stream type just for initialization errors, but we should redesign the flow for initialize in general to use a response.

from flutter.

stephane-archer avatar stephane-archer commented on June 10, 2024

@stuartmorgan is there anything I can run to help you understand better the issue?

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.