19

I’ve used fijkplayer library which is available on flutter to play m3u8 videos. Playing without download is working fine and the issue only happens when I trying to play downloaded videos. Also, I tried other libraries like chewie, flutter_jikplayer, flutter_tencentplayer but none of them worked.

This issue happens only on the hls links of Vimeo. I’ve implemented everything using a public hls link available on the internet. After that, I found this bug.

This output seems to be a protocol related issue.

The xcode output is,

===== versions =====
ijkplayer    : f0.7.8
FFmpeg       : ff4.0--ijk0.8.25--20191031--001
libavutil    : 56.14.100
libavcodec   : 58.18.100
libavformat  : 58.12.100
libswscale   : 5.1.100
libswresample: 3.1.100
===== options =====
player-opts : overlay-format               = fcc-bgra
player-opts : videotoolbox                 = 1
player-opts : enable-position-notify       = 1
player-opts : start-on-prepared            = 1
format-opts : ijkapplication               = 4850081840
format-opts : ijkiomanager                 = 4849971424
===================
Opening 'https://46vod-adaptive.akamaized.net/exp=1597409385~acl=%2F04cf7e17-5507-416e-97c2-a26f6a27d395%2F%2A~hmac=2d7bd4c50e30032541752817b808bd618f7b0fff4a472e3d0b481f0aa2bd11f5/04cf7e17-5507-416e-97c2-a26f6a27d395/sep/audio/7724a1ec/playlist.m3u8' for reading
Protocol 'https' not on whitelist 'file,crypto'!

/var/mobile/Containers/Data/Application/0851E4DB-AA4C-4346-A6F2-5F2D00478D61/Documents/offline/+919744480203133/playlist.m3u8: Invalid argument

Let me know if anything is require, Will update here.

iPatel
  • 46,010
  • 16
  • 115
  • 137
  • 1
    i dont know whether u came across this, please check https://stackoverflow.com/questions/50455695/why-does-ffmpeg-ignore-protocol-whitelist-flag-when-converting-https-m3u8-stream – Yadu Aug 17 '20 at 09:05
  • 1
    I've done this before in flutter_jikplayer as below var option1 = IjkOption(IjkOptionCategory.format, "protocol_whitelist", "concat,http,tcp,https,tls,file"); controller.setIjkPlayerOptions( [TargetPlatform.iOS, TargetPlatform.android], [option1].toSet(), ); But din't work for me – iPatel Aug 17 '20 at 10:01
  • 1
    I tried accessing that link, it says permission denied. Your error message also says `crypto`, are you able to access this HLS link using a different client? – Ben Butterworth Aug 24 '20 at 08:46
  • @BenButterworth Yes. It's working fine on HTML5 players, And it's also working on exoplayer. – iPatel Aug 25 '20 at 04:47
  • 1
    use chewie with dispose or state management. – Mouaz M Shahmeh Mar 14 '22 at 20:12

1 Answers1

1

The HLS files expire after a certain amount of time. So if you're downloading the m3u8, you're not actually downloading the video, just a link to the playlist/manifest file that tells the player where to pull the real (usually mp4) video files from. You can see similar examples with the M3U (this example links to mp3 files, but m3u8 usually links to mp4 files).

So instead you'll want to download the actual mp4 files from Vimeo and then pass those files to your player. I gave an answer here that talks through one way to do that. (Here's how to download with Flutter).

The links to the mp4 files expire as well. But if you download them before they expire, you can access them anytime from disk (using the local file URL).

Kyle Venn
  • 4,597
  • 27
  • 41