eneim / toro

Video list auto playback made simple, specially built for RecyclerView
Apache License 2.0
1.42k stars 253 forks source link

[Bug report] Hls videos always picks the Highest quality stream intially #501

Open shiv71 opened 3 years ago

shiv71 commented 3 years ago

Toro Version - im.ene.toro3:toro:3.7.0.2804-SNAPSHOT Android - Any Device Name - Any

Issue - When I play an adaptive bit rate HLS stream in toro Recycler view it plays highest resolution stream on wifi, but it waits for 3-4 seconds before playing. How do I fix it to start immedietly ? The same video plays fine on iOS.

Please see videos for more clarification Android - https://drive.google.com/file/d/1QQ_Ie3IxcHgbD-FQir8zaP5VNEnT7OaL/view?usp=drivesdk iOS - https://drive.google.com/file/d/1QR1aI_BQCQseWkDiMl-nFlbKMUmFYTZY/view?usp=drivesdk

rahulvyas commented 3 years ago

@eneim any idea about this ?

rahulvyas commented 3 years ago

@archie94 Do you have any idea for this issue ?

archie94 commented 3 years ago

Hi @rahulvyas I am afraid I do not.

rahulvyas commented 3 years ago

Hi @rahulvyas I am afraid I do not.

Ah okay.

One thing I would like to confirm is that if we pass config when initialising ExoPlayerViewHelper it picks the proper HLS stream like (600k,1M,2M etc) but if we do not pass config explicitly then toro player directly picks 2M stream only. Do you have any idea about this behaviour ? Can you share your thoughts on how we can improve startup performance of videos in recyclerview ? We already have AWS Cloudfront Adaptive bitrate videos in our backend

rahulvyas commented 3 years ago

@archie94 @thiagoricieri @eneim

I am trying to improve startup performance of videos in recycleriew. I found one article which suggests to set setAllowChunklessPreparation(true)

From this medium article https://medium.com/google-exoplayer/faster-hls-preparation-f6611aa15ea6

Sounds good, how do I opt-in? Available today on our dev-v2 branch, and to be available from the 2.7 release, you just need to set allowChunklessPreparation to true when creating your HlsMediaSource. Like so:

new HlsMediaSource.Factory(dataSourceFactory)
    .setAllowChunklessPreparation(true)
    .createMediaSource(uri, mainHandler, eventLogger)

That's it. HlsMediaSource will try to prepare without downloading any media chunks.

How do I set this property in ToroPlayer/ExoPlayerViewHelper ?