syonip / flutter_fbstorage_video_upload

MIT License
34 stars 31 forks source link

Can't play video in Flutter #12

Open ffriande opened 2 years ago

ffriande commented 2 years ago

Hi, I'm following this tutorial and I'm having trouble managing to play the video in a player. I have tried the following three players: Chewie, video_player and fijkplayer, without any success, so I figure the issue is to do with the .m3u8 files, or maybe with the ffmpeg command.

Here are the resulting .m3u8 files :

https://firebasestorage.googleapis.com/v0/b/test-a5584.appspot.com/o/video_stream%2Fvideo1%2Fmaster.m3u8?alt=media&token=db8f5331-17e0-4018-b66a-65a6a02c45de and https://firebasestorage.googleapis.com/v0/b/test-a5584.appspot.com/o/video_stream%2Fvideo1%2FplaylistVariant.m3u8?alt=media&token=63b5cc6e-4a41-4d4b-8fb8-4994619a5a13

What could be wrong here?

syonip commented 2 years ago

Hi @ffriande , When trying to load the ts files I'm getting 403 error: https://firebasestorage.googleapis.com/v0/b/test-a5584.appspot.com/o/video_stream%2Fvideo1%2FfileSequence_0.ts?alt=media

{
  "error": {
    "code": 403,
    "message": "Permission denied."
  }
}

So that's your problem I guess.

ffriande commented 2 years ago

Hi @syonip . I don't understand... I am able to access that link, I have also tried accessing with other computers and in private browsing. Storage rules are the same that the tutorial presents. Any idea of what is happening?

ffriande commented 2 years ago

The error that is thrown is the following

D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 E/ExoPlayerImplInternal( 8125): Playback error E/ExoPlayerImplInternal( 8125): com.google.android.exoplayer2.ExoPlaybackException: Source error E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:580) E/ExoPlayerImplInternal( 8125): at android.os.Handler.dispatchMessage(Handler.java:102) E/ExoPlayerImplInternal( 8125): at android.os.Looper.loop(Looper.java:201) E/ExoPlayerImplInternal( 8125): at android.os.HandlerThread.run(HandlerThread.java:65) E/ExoPlayerImplInternal( 8125): Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403 E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:383) E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84) E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:101) E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.upstream.DataSourceInputStream.open(DataSourceInputStream.java:64) E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:177) E/ExoPlayerImplInternal( 8125): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:417) E/ExoPlayerImplInternal( 8125): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/ExoPlayerImplInternal( 8125): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/ExoPlayerImplInternal( 8125): at java.lang.Thread.run(Thread.java:764) E/flutter ( 8125): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null) E/flutter ( 8125): D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0 D/AudioManager( 8125): getStreamVolume isRestricted mode = 0

syonip commented 2 years ago

There's a 403 response code in the error log you sent:

E/ExoPlayerImplInternal( 8125): Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403

I tried playing the video on my device and it plays fine.

ffriande commented 2 years ago

There's a 403 response code in the error log you sent:

E/ExoPlayerImplInternal( 8125): Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403

I tried playing the video on my device and it plays fine.

Thanks so much for the reply @syonip.

So, if you were to take a guess, what would you say the issue is?

syonip commented 2 years ago

I'm interested how at first I got 403 and then I didn't. Did you change something?

On Wed, 13 Oct 2021 at 17:45, Francisco Friande @.***> wrote:

There's a 403 response code in the error log you sent:

E/ExoPlayerImplInternal( 8125): Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403

I tried playing the video on my device and it plays fine.

Thanks so much for the reply @syonip https://github.com/syonip.

So, if you were to take a guess, what would you say the issue is?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/syonip/flutter_fbstorage_video_upload/issues/12#issuecomment-942379979, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJKLCIJJAJTG64AJVVBZOLUGWLQZANCNFSM5FXZO44Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ffriande commented 2 years ago

Hi @ffriande , When trying to load the ts files I'm getting 403 error: https://firebasestorage.googleapis.com/v0/b/test-a5584.appspot.com/o/video_stream%2Fvideo1%2FfileSequence_0.ts?alt=media

{
  "error": {
    "code": 403,
    "message": "Permission denied."
  }
}

So that's your problem I guess.

I have no idea, I guess Storage Rules take some time to get published and that might be the reason, since I changed them not to require a token and you were trying to access an url with no token.

The fact that you can play the video and I can't is just too weird...

syonip commented 2 years ago

Maybe after you changed the security rules, try to upload a new video and test that one. Maybe some strange caching going on.