HLS Video Loading Error through Chromecast



I have been messing around a plugin that already exists but that was not fully taking advantage of HLS. It was fetching the master playlist m3u8, parsing it's content and building the final URL with one specific m3u8 file. Since HLS is meant to adapt itself based on the current bandwitdth of a player, I decided i'd thrown in and skip the parsing/URL and building part and just return the master playlist in the media object part.

You can see exactly the modification I have made here : https://github.com/mberube09/Lazyman.bundle/commit/66f27a4dff9ba91ea4146138d29ae36f2fdbfd4d

I have been able to play the HLS video from the desktop application on remote access. But when I tried to cast to to my chromecast (even with a Chromecast Ultra on a wired connection), I have the following error: Not enough bandwidth for any playback of this item. Cannot convert to below minimum bandwidth of 77kbps.

This was working fine before my fix. Have I done something wrong?

Attached file is the Plex Media Server logs.


Seems like adding those keys in the MediaObject will fix the playback on the chromecast :

            video_frame_rate = 60,
            video_resolution = 720,
            audio_channels = 2,

But those settings are hardcoded from the playlist because I know they are the max possible values.. Is that okay? Should I use the minimal values from the m3u8 playlist? Would that change something on the playback?


First, I am a little confused by your code. If you are not going to use a separate URL service to create you media objects, then it is always best to create a separate function within your plugin for creating the media objects that can loop through twice and create the pre-play screens used by most players. Otherwise your success with playback on Plex player apps will be affected.

The HGTV channel plugin is an example of a plugin that does not have a separate URL service and includes a function to create the media objects for all of its videos- github.com/plexinc-plugins/HGTV.bundle/blob/master/Contents/Code/init.py#L265. And the RT-USA channel plugin includes a function to create the media objects for its live streams - github.com/plexinc-plugins/RTUSA.bundle/blob/master/Contents/Code/init.py#L131.


Thanks for the reply. Note that this is not my code and i'm trying to dig through an existing channel which was confusing to me at first. So if you would dare explain to me what is a separate URL service to create media objects, or point to where where I could learn the trick, i'd be happy to!

From what I see in the HGTV bundle, seems like the code assume 3 resolutions, but what if the master playlist contains other resolutions? isn't the goal behind HLS to let video players to use the master playlist as a reference to adapt itself based on the current bandwidth? I don't understand the need of hardcoding resolutions upfront as they are supposed to be in the master m3u8 playlist


The Channel Plugin Development Support Documents thread that is pinned to the top of this section of the forum contains documents I have created that can provide the basic concepts of plugin development. They are not in-depth tutorials, but they can help you understand the basics so you will know where to start, where to look next.or what questions you may need to ask, especially the Overview and FAQ.

So as for a better understanding of a URL service, in that thread I have created a document called "Introduction to URL Services" that will give you the basics of a URL service. And all of the URL services that are used for PlexIt/Watch Later videos and channel plugins in the Channel Directory are part of the Services.bundle and can be easily searched from Github, which makes them a great resource. See github.com/plexinc-plugins/Services.bundle

The Plex Plugin Development Walkthrough, Framework Documentation, and the Plex support site's section for Channel Development Support documents can provide more specific and detailed instructions for the various parts of Plex channel plugin development.


Now as for handling multi-quality m3u8s. It is best to just pull the multi-quality m3u8 stream URL offered by an online source and provide its media object attributes. The individual Plex player apps should read these multi-quality m3u8s and choose the best quality option to use, based on the users online video quality setting on that Plex player app.

Now supposedly the native software/SDK of a couple players/devices do not provide the option to read the various media values in a multi-quality m3u8 (though no one has ever told me what those specific players/devices may be). But the software/SDK for most players/devices used for Plex can and should be able to read and choose the qualities offered in a multi-quality m3u8.

But unfortunately some Plex player apps are just not programmed properly. So they just choose the first stream listed in a multi-quality m3u8, even if that is the lowest quality listed. The Android software, for example, is able to read and determine the various qualities offered in a multi-quality m3u8, but the Plex player apps for Andriod devices just chooses the first item listed. This issue has been reported to the Plex player app developers for Andriod devices, but they have yet to fix it.

Now you may find plugin code where the developer pulls the individual streams from a multi-quality m3u8 to work around a Plex player app that that is not properly programmed. But the plugin framework is not designed to access and parse m3u8 data (that is why the code for it can be confusing). And I personally believe that you should not use any "work arounds" to deal with issues with the various Plex player apps, because it does not encourage Plex to fix the issues with the individual Plex player apps that are not properly programmed.

And a work around that may fix an issue on one Plex player app may also create issues using another Plex player app. For example, splitting a multi-quality m3u8 into multiple media object versions may help you resolve issues using the Plex player app for Andriod devices, but Plex Web (browser interface) and Plex Media Player (PMP) do not even recognize multiple versions of a channel plugin media object, so that work around for Plex Andriod users would just create a new problem for Plex Web or PMP users.

Also, I am currently working on a pinned document so plugin developers can be aware of and share knowledge of known issues with the various Plex player apps and the plugin framework. See Known Plex player app and PMS issues supporting Plugin Framework.


Very interesting! Hopefully plex players will fix their issues because it is the goal behind having multi-quality m3u8 is to adapt the playback with the current bandwidth.

I guess that the Chromecast Plex player is one of those as it seems it cannot find the proper media object because it's lacking information (resolution, frame rate, etc). I also realised yesterday while watching a live stream that it was not adapting at all. I mean, if at times it was lacking bandwidth to display video, it displayed a spinning loader instead of lowering the quality.

Thanks for the information posted I will take the time to read about it.


The "Plex Player App/Plex Media Server Issues" section of the READ FIRST: Guidelines for Posting Channel Plugin Issues/Questions and Things to Check First thread and the "Why won't any of the videos play on one or more of my channel plugins?"section of the Frequently Asked Questions for Channel Plugins thread that are pinned to the top of the Channel Plugin section of the forum provide more information on figuring out playback issues with channel plugin media on a specific Plex player.

You would need to check the codec support of the Chromecast player to see if it can direct play or must transcode HLS media. And the Chromecast playback is more complicated, since it is confusing to figure out what part is controlled by the Plex app for Chromecast and what part is controlled by the Plex app on your mobile device that you are casting the media from. You would definitely have to refer to the Chromecast section of the forum to isolate playback issues on the Chromecast app, since the casting makes any playback issues much more complicated.


And for live HLS streams, Plex is not supposed to be able to transcode live streams from plugins, so the player/device must be able to direct play HLS live streams. See Why Can I Not Get a Live Stream to Play on Plex?.

There are a few live streams that I have found that will transcode on newer versions of Plex Media Server, due to the LiveTV/DVR feature, but that is very hit or miss. See the "Transcoding Live Streams in Channel Plugins" section of Known Plex player app and PMS issues supporting Plugin Framework thread pinned to the top of this forum.