question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to download metadata (duration) for all MediaItems in a playlist?

See original GitHub issue

Searched documentation and issues

StackOverflow, Issues, Documentation, Blog

Question

When loading/playing a playlist using the new playlist api introduced in 2.12.0, only data for the first item is loaded up until a few seconds before the transition to the next item happens. Window.durationMs from the second item stays C.TIME_UNSET until this point.

While this is perfectly fine for most applications, I do need the duration of all MediaItems in the playlist upon loading.

This leads me to the question if there is any way to configure the loading behaviour of a playlist to include the duration (manifest?) of all items right at the beginning?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marcbaechingercommented, Sep 24, 2020

I created a playlist with 4 items. With the default configuration the first two items are prepared initially (the media is quite short that’s why the second item is prepared as well). But then it waits until playback advances to prepare the third and fourth item.

The third item is prepared after about 69 seconds:

timeline [eventTime=69.18, mediaPos=68.14, window=0, period=0, periodCount=4, windowCount=4, reason=SOURCE_UPDATE

When setting useLazyPreparation to false, all media sources are prepared immediately as expected:

mediaItem [eventTime=0.01, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
timeline [eventTime=0.23, mediaPos=0.00, window=0, periodCount=4, windowCount=4, reason=SOURCE_UPDATE
timeline [eventTime=0.24, mediaPos=0.00, window=0, period=0, periodCount=4, windowCount=4, reason=SOURCE_UPDATE
timeline [eventTime=0.28, mediaPos=0.00, window=0, period=0, periodCount=4, windowCount=4, reason=SOURCE_UPDATE
timeline [eventTime=0.77, mediaPos=0.00, window=0, period=0, periodCount=4, windowCount=4, reason=SOURCE_UPDATE
  period [128.27]
  period [135.65]
  period [59.30]
  ...
  window [128.27, true, false]
  window [135.50, true, false]
  window [59.18, true, false]

The logs (printed by EventLogger) show that all four SOURCE_UPDATEs arrived after 0.77 seconds when the media position is still on 0.0. The list of windows in the log is kept at a max of 3 but it shows that the durations are available already.

If you see a different behaviour, can you add the EventLogger to your app and do a bug report when you prepare your player and the upload this here so I can investigate?

0reactions
strangesourcecommented, Sep 25, 2020

Thanks @marcbaechinger, this helped me out a lot. The workaround propposed in the issue might work for us as well. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize media notifications and handle playlists
With the brand new Media Session API, you can now customize media notifications by providing metadata for the media your web app is...
Read more >
Creating and Configuring Playlists - Kaltura Knowledge Center
Select the Content tab and then select the Playlists tab. · Select Add Playlist. · The Add New Playlist screen opens. · Click...
Read more >
How to Fix Plex Metadata / Agent Download Problems
In this video, I show you how to fix common Plex Media Server problems with the retrieval of the correct cover art, background...
Read more >
Web API - Spotify for Developers
Based on simple REST principles, the Spotify Web API endpoints return JSON metadata about music artists, albums, and tracks, directly from the Spotify...
Read more >
MediaStore.Audio.Playlists - Android Developers
The "instance ID" GUID as defined by the XMP Media Management standard, extracted from any XMP metadata contained within this media item.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found