harmonwood / capacitor-video-player

Capacitor Video Player Plugin
MIT License
112 stars 46 forks source link

Play TS file that is not completed #123

Open fegauthier opened 1 year ago

fegauthier commented 1 year ago

Hi!

I have an issue with ExoPlayer and maybe you guys know how to fix this.

My app currently record a stream to a file using FFmpeg. Let's say that the file is named Test.ts. The file is located to the internal storage of the device.

I'm using this player to play Test.ts during the record by FFmpeg. So let's say I start the playback when the file has 3 minutes of playback. The video stop after 3 minutes even if the file is now 6 minutes duration. Is there a config to keep playing the file even if at start the duration was 3?

It seems to work with VLC for Android, so I think it can be possible with ExoPlayer?

Thanks!

fegauthier commented 1 year ago

https://github.com/google/ExoPlayer/issues/2095

jepiqueau commented 1 year ago

@fegauthier may be you can try the recommandation from the Exoplayer developer and make a PR tohave it implemented in the plugin

fegauthier commented 1 year ago

@fegauthier may be you can try the recommandation from the Exoplayer developer and make a PR tohave it implemented in the plugin

I created a CustomDataSource from FileDataSource and every 10 seconds, I read the file to see if the length is greater. If yes, then I add the remainingBytes. It seems to work well. I will test it for a couple hours and surely do a PR for that :P

Thanks!

jepiqueau commented 1 year ago

@fegauthier Good. This datasource will be used only for ts file for the others movie types i assume the plugin will use the others datasources

jepiqueau commented 1 year ago

@fegauthier What is the extension for TS files? Does the iOS video player read them?

fegauthier commented 1 year ago

I will probably add a flag in the initPlayer like inProgressStream. Which will use the CustomDataSource. Because this situation is not sticked to .TS files but every files that you can read while another process is currently writing it.

TS is for MPEG-TS. The extension file is .ts. I'm sure that iOS video player can read it. It's an old video format.

jepiqueau commented 1 year ago

@fegauthier i had a quick look in iOS AVplayer does not read the .ts file what i found is that you must put them in a m3u8 playlist , so this conversion may be done on a server-side or in your app and you can continue adding to the playlist even if you start reading. In that case it may work on all platform as an hlsvideo type.I do not know where you stand on your side. So i do not think i will support this type of format. Waiting your answer and i will close this.

fegauthier commented 1 year ago

@fegauthier i had a quick look in iOS AVplayer does not read the .ts file what i found is that you must put them in a m3u8 playlist , so this conversion may be done on a server-side or in your app and you can continue adding to the playlist even if you start reading. In that case it may work on all platform as an hlsvideo type.I do not know where you stand on your side. So i do not think i will support this type of format. Waiting your answer and i will close this.

I don't know how it works on the Apple side because I don't use it. ExoPlayer support this type of behavior with CustomDataSource, but there's another limitation... We cannot seek the file while it's growing... I didn't find any solution at this time. On my side, I'm using ExoPlayer to read file directly (mkv, ts, mp4, etc.). I'm not using it for with hls