You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[video_player] VideoPlayerController.initialize() never return if the file is invalid (text file) #147707
if file is a .fish file (a shell script that is not a video but a text file) await controller.initialize(); will never return or throw an exception, you wait indefinitely...
Expected results
if the file is not a video it should throw an exception
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.
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.
in this case, the file is: "/Volumes/Macintosh HD/Users/fractale/Desktop/proxy_research/benchmarktorun.fish"
it has execution permission and the content is:
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.
Activity
darshankawar commentedon May 2, 2024
Thanks for the report @stephane-archer
I tried a sample text file with plugin's example with which I received below log:
Do you see same exception ? It does throw
.UnrecognizedInputFormatExceptionwhich seem to be expected as the file passed is non-video file.stephane-archer commentedon May 2, 2024
@darshankawar I don't see any exception on MacOS.
await controller.initialize();never finish.You should probably do the same test on MacOS
darshankawar commentedon May 3, 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 ?
stephane-archer commentedon May 3, 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.
stephane-archer commentedon May 3, 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:
darshankawar commentedon May 6, 2024
Thanks for the update. Keeping the issue open for tracking.
14 remaining items
stuartmorgan-g commentedon May 13, 2024
Currently the way the plugin is designed,
initializecompletion 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 withinitialize.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
initializein general to use a response.stephane-archer commentedon May 13, 2024
@stuartmorgan is there anything I can run to help you understand better the issue?
[video_player_avfoundation] send video load failure even when eventsi…
stuartmorgan-g commentedon Nov 22, 2024
[video_player_avfoundation] send video load failure even when eventsi…
ddikman commentedon May 26, 2025
choim4389 commentedon Oct 24, 2025
fix: added video initialization timeout (#3313)
fix: added video initialization timeout (#3313)
fix: added video initialization timeout (#3313)
[video_player_avfoundation] send video load failure even when eventsi…
[video_player_avfoundation] send video load failure even when eventsi…