Open narumi147 opened 1 year ago
I test on 3.10 now, and it works well for me.
Could you tell me which video file / url you are playing?
https://static.atlasacademy.io/JP/Movie/talk_mov169.mp4
app downloaded it first, then create controller via Controller.file()
. The default win10 player can play the file normally.
Tried on 2 windows devices, the same error.
To clarify, some (and I think almost) video files are playable with this package. Only some video files play failed.
Unfortunately, the video file you provided play failed with this package, although I know Window Media Player can play it.
I also tried the Microsoft official sample code topoedit & protectedplayback, which are use Microsoft Media Foundation topology API too, they also cannot play the video file you provided, but can play my other video files well.
Since the above 2 official Microsoft samples play failed too, so I have no idea how to solve this issue... orz Maybe you should try other packages if it's really a problem for you :(
turned out it was because of audio format. This mp4 is h264 video + flac audio, and Media Foundation doesn't support flac format. Now the audio format has changed to aac, and it works fine.
But in v1 plugin, I remember it can play the file, when I first introduce this plugin to app. Not sure what's the difference between v1 and v2, even if they both use Media Foundation API.
So I guess here are something we can improve:
load fail, reload now
printed during controller init?)I saw you set value = value.copyWith(isInitialized: false, hasError: true, isPlaying: false)
after error.
But that's WinVideoPlayerValue
which I cannot get from VideoPlayerController.value/VideoPlayerValue
.
And after error, the VideoPlayerValue
is kept InInitiated
true, didn't update to false.
About FLAC format, I tried these flac file, and this package can play them.
So I think the FLAC format is supported if K-lite codec installed.
I also tried to ignore any audio tracks, and this package can play the file you provided. (of course only video, no audio)
Your video file maybe has some unusual data, and the codec just cannot handle it. But this cannot explain why Windows Media Player can play it... (but official Microsoft sample code cannot play it, mentioned before)
About the error handling improvement you asked, because the codec doesn't report error in normal way, so I cannot do as your wish.
Why I print load fail, reload now
,
because when playing a video successfully,
there are many state-change occurs in MyPlayer::Invoke
method,
but when playing your video file, or when playing network url failed if socket timeout,
the state-change acts in a different way, so I will reload it.
But I cannot distinguish them, so I cannot just report error to user.
And if codec cannot parse file successfully,
it should return false in BeginCreateObjectFromURL
and in its callback, but it didn't in your video file.
So currently I won't change the code.
Thanks for the detailed research!
First sorry i didn't tell that I don't install extra decoder like K-Lite, just want to suggest pointing out what formats are supported by default only with this plugin. And I saw your commit, that's what I want.
Then as for the main appeal, if it's not possible to report error to user at present. Is it possible to update VideoPlayerValue.IsInitialized
from WinVideoPlayerControllerValue if error happened and the video is actually not playing?
So I can check IsInitialized to decide to redownload file or not.
is there any update on this?
@annd22,
narumi147
has pointed out the following 2 questions:
** flac audio not support K-lite codec pack support it, and he has clarified that he not installed K-lite codec pack so load failed (May 14, 2023 post)
** WinVideoPlayerValue.IsInitialized is not passed to VideoPlayerValue.IsInitialized I just test it 1 minute ago and it works fine.
** WinVideoPlayerValue.IsInitialized is not passed to VideoPlayerValue.IsInitialized
I think this is not correct.
At the file video_player_win.dart
, case 7, I have to fork the project and modify:
case 7: // MEError
log("[video_player_win] playback event: error");
value = value.copyWith(
isInitialized: false, hasError: true, isPlaying: false);
// <-- add event to update isInitialized to false
_eventStreamController.add(VideoEvent(
eventType: VideoEventType.initialized, duration: null, size: null));
_cancelTrackingPosition();
break;
Without the modified code, the value of isInitialized don't updated.
@annd22, Thanks for the code patch.
I try to fix it and upload to github. Please try it and let me know if it works in your case.
dependencies:
video_player_win:
git:
url: https://github.com/jakky1/video_player_win.git
ref: master
After update to flutter 3.10No related to flutter 3.10 video player always failed to load video file.VideoPlayerController.initialize
didn't throw the error, the win plugin only printedSince the error is not thrown, the app will treat it as initiated and playing(though it is errored). when calling
pause
. it will throwMaybe errored before 3.10