Comments (13)
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.
@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.
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',
[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.
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.
from flutter.
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.
Thanks for the update. Keeping the issue open for tracking.
from flutter.
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.
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.
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.
I ran @navaronbracke sample, you can see the code timeout:
-rwxr--r-- 1 fractale staff 599B May 1 16:53 benchmarktorun.fish
from flutter.
[✓] 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.
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.
@stuartmorgan is there anything I can run to help you understand better the issue?
from flutter.
Related Issues (20)
- [Flutter Windows] Japanese Textfield does not work properly when setState is present in onChanged(v) or inputFormatters are added HOT 3
- Cyrillic alphabet rendered incorrectly for Impeller in Android HOT 3
- Attempt to create wrapped long text results in exception in framework HOT 1
- Outdated Release Information in Flutter's Release Section HOT 1
- Black Screen and Navigation Errors After Adding Product in Flutter App HOT 1
- [in_app_purchase] queryProductDetails returns empty product list on android HOT 15
- [in_app_purchase] App crashes while buying non consumable subscription HOT 5
- [material/menu_anchor.dart] _MenuAnchorState is not always GC'd HOT 1
- [go_router][Web] context.go() does not remove navigation stack HOT 1
- [CP] Fix TwoDimensionalViewport's keep alive child not always removed (when no longer should be kept alive) HOT 6
- `RoundedRectSliderTrackShape` corners are not rendered correctly
- Slider thumb doesn't respect round slider track shape
- Undefined variable error in flutter web index.html file HOT 2
- disabled DropdownMenu can be changed HOT 5
- Engine unit tests using dart2wasm are failing to compile on dart sdk roll HOT 1
- Dart -> Engine roll failing on dart2wasm compilation failures HOT 4
- [Impeller] impellerc's spirv optimization pass produces for loop that is invalid in WebGL. HOT 1
- [Impeller] gaussian and morphology shaders use a dynamic for loop bound, which is incompatible with WebGL. HOT 3
- [Impeller] OpenGLES backend tries to reuse buffers across different buffer targets, which fails on WebGL. HOT 2
- Cause java format to fail when java binary is not found. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter.