Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

How do I get the filename of the currently playing item from a playlist containing more than one?


I know that I can use playerInstance.getPlaylistItem()['file'] to return the name of the _first_ source file in the currently playing playlist, but I have a playlist containing low and high resolution versions of the same video, and I would like to return the name corresponding to the version the user is actually watching. I have reviewed the API documentation, and I cannot see a way of doing this. Am I missing something obvious? What I need is a way to return the index of the current source within the current playlist item, _not_ the index of the current playlist item within the playlist array - the latter is always 0, since there is only one item in it.

2 Community Answers

Todd

JW Player Support Agent  
1 rated :

jwplayer().getPlaylistItem()[‘sources’][jwplayer().getCurrentQuality()].file

peter

User  
0 rated :

Thanks! That works well. For the benefit of anyone else who finds this thread while researching this question, it appears that .getCurrentQuality() only returns a valid index if a video is actually _playing_. If the player is displayed but the video has not been started, it returns -1. There is logic to this, though I would probably have decided to return the index of the default video file under these circumstances.

This question has received the maximum number of answers.