syonip/flutter_fbstorage_video_upload

Can't play video in Flutter

ffriande opened this issue · 8 comments

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?

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.

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?

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

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.

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?

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...

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