Open narasimharao11 opened 1 year ago
Also can you please suggest how to contact exoplayer team in future.
You found the best spot already. This is the right place.
Can you suggest us some ways to reduce this loading time.
The first step for reducing load time is analyzing where the time is spent and what you measure.
The logs that you attached shows, that the first frame was rendered after 2.52 seconds after creation of the player. So when you say its taking around 6-7 sec to load HLS streams
you are measuring differently than what the EventLogger
reports. If you see the stream starting in 6-7 seconds only in the app that delivers the log files below, then something is wrong elsewhere that would explain startup latency.
Usually, for an HLS stream, 2 playlists need to be downloaded and then the media files referenced in the playlists. So for video/audio there are 4 network requests to be done.
Ways to reducing start up time:
DefaultLoadControl
When a stream is loaded by using setMediaItem(item)
or setMediaSource(source)
, then the initial start time will always be constraint by the loading requirements mentioned above. If you have multiple streams, that you set to the player playlist (setMediaItems(mediaItems)
) and you the disable lazy preparation ExoPlayer.Builder.setUseLazyPreparation(false)
, you may be able to improve loading time for a second stream significantly. The second stream is the already prpeared in the playlist when started.
Roughly you have always two live HLS streams in your playlist and when the next is requested you seekTo(1, C.TIME_UNSET)
. Then you remove the other stream and set the next one for preloading into the playlist. So yoiu dynamically preload with the stream that you predict the user will use next (if this is possible for your use case). I can't give you support for this beyond mentioning this here I'm afraid. It requires some tinkering on your side to find how well this works with your streams. I've seen this working quite well in a prototype I once did.
For your info: Where is the time spent according to your logs?
The first timeline refresh arrived after 1.20 seconds.
2023-06-19 18:15:32.094 2606-2606 EventLogger com.google.android.exoplayer2.demo D timeline [eventTime=1.30, mediaPos=20.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
2023-06-19 18:15:32.094 2606-2606 EventLogger com.google.android.exoplayer2.demo D period [?]
2023-06-19 18:15:32.094 2606-2606 EventLogger com.google.android.exoplayer2.demo D window [32.00, seekable=true, dynamic=true]
2023-06-19 18:15:32.094 2606-2606 EventLogger com.google.android.exoplayer2.demo D ]
Renderer enabled and track selection 1.60 seconds:
2023-06-19 18:15:32.380 2606-2606 EventLogger com.google.android.exoplayer2.demo D videoEnabled [eventTime=1.58, mediaPos=20.00, window=0, period=0]
2023-06-19 18:15:32.383 2606-2606 EventLogger com.google.android.exoplayer2.demo D audioEnabled [eventTime=1.59, mediaPos=20.00, window=0, period=0]
2023-06-19 18:15:32.394 2606-2606 EventLogger com.google.android.exoplayer2.demo D tracks [eventTime=1.60, mediaPos=20.00, window=0, period=0
2023-06-19 18:15:32.395 2606-2606 EventLogger com.google.android.exoplayer2.demo D group [
2023-06-19 18:15:32.395 2606-2606 EventLogger com.google.android.exoplayer2.demo D [X] Track:0, id=0, mimeType=video/avc, bitrate=2040998, codecs=avc1.4d001f, res=704x396, supported=YES
2023-06-19 18:15:32.395 2606-2606 EventLogger com.google.android.exoplayer2.demo D [X] Track:1, id=1, mimeType=video/avc, bitrate=1375020, codecs=avc1.4d001f, res=640x360, supported=YES
2023-06-19 18:15:32.395 2606-2606 EventLogger com.google.android.exoplayer2.demo D [X] Track:2, id=2, mimeType=video/avc, bitrate=766358, codecs=avc1.4d001f, res=512x288, supported=YES
2023-06-19 18:15:32.395 2606-2606 EventLogger com.google.android.exoplayer2.demo D [ ] Track:3, id=3, mimeType=video/avc, bitrate=519020, codecs=avc1.4d001f, res=384x216, supported=YES
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D [ ] Track:4, id=4, mimeType=video/avc, bitrate=313284, codecs=avc1.4d001f, res=256x144, supported=YES
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D ]
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D group [
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D [X] Track:0, id=0, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, supported=YES
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D ]
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D group [
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D [X] Track:0, id=ID3, mimeType=application/id3, supported=YES
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D ]
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D Metadata [
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D HlsTrackMetadataEntry
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D ]
2023-06-19 18:15:32.396 2606-2606 EventLogger com.google.android.exoplayer2.demo D ]
2023-06-19 18:15:32.818 2606-2606 EventLogger com.google.android.exoplayer2.demo D downstreamFormat [eventTime=2.02, mediaPos=20.00, window=0, period=0, id=0, mimeType=null, bitrate=2040998, codecs=avc1.4d001f,mp4a.40.2, res=704x396]
First frame rendered 2.52:
2023-06-19 18:15:33.315 2606-2606 EventLogger com.google.android.exoplayer2.demo D videoSize [eventTime=2.52, mediaPos=20.00, window=0, period=0, 704, 396]
2023-06-19 18:15:33.321 2606-2606 EventLogger com.google.android.exoplayer2.demo D renderedFirstFrame [eventTime=2.52, mediaPos=20.00, window=0, period=0, Surface(name=null)/@0xac4d306]
Hi @marcbaechinger , We have tried implementing your suggested ways to reduce start up time: Make servers deliver data quickly, Avoid HTTP redirects and Configure DefaultLoadControl are already taken care of. We have also tried with setLazyPreparation but no improvement was observed in startup time reduction. Can you please tell how to to enable this chunkless Preparation inExoPlayer version 2.18.1 with HLS streams.
Please find latest attached logs below.
Can you please tell how to to enable this chunkless Preparation inExoPlayer version 2.18.1
The link from above should be sufficient I think . You need to turn the flag to true in the builder.
I'm facing the same issues. Did you manage to improve the loading times @narasimharao11 ?
Hi Team, We are facing an issue with player initialization time to load HLS streams. Its taking around 6-7 sec to load HLS streams. In exoplayer demo app we have hardcoded our stream urls and its taking around 4-5 sec to load the content. We want to reduce player loading time, Can you suggest us some ways to reduce this loading time. Exoplayer version in use : 2.18.1
Also can you please suggest how to contact exoplayer team in future.
exoplayer2DemoLogs.txt