Multi-part media will fail to play second part

Using the Plex Plug-in 2.1 framework to support a media that is split into 2 parts.

Once the first part is finished the second part start but will end within 1 min (even if the second part is 57 min).

I have verified both parts using VLC and they play just fine.



The code for creating the media is below:





                track = TrackObject(<br />
                        title = itemtitle,<br />
                        key = itemlink,<br />
                        rating_key = MUSIC_PREFIX + "/" + unitid + "/" + broadcastid,<br />
                        thumb = channellogo,<br />
                        duration = duration<br />
                )<br />
                media = MediaObject(<br />
                        audio_codec = AudioCodec.MP3,<br />
                        duration = duration<br />
                )<br />
                for brfile in item.getiterator('broadcastfilename'):<br />
                        brid = brfile.attrib.get("broadcastid")<br />
                        brdur = int(brfile.attrib.get("duration")) * 1000<br />
                        brlink = baseurl.replace("[broadcastid]",brid)<br />
                        Log.Info("brlink %s dur %d", brlink, brdur)<br />
                        media.add(PartObject(key = brlink, duration = brdur))<br />
                track.add(media)<br />
                dir.add(track)



Is this a known issue or is there something obvious wrong in the core?

Full source code can be found here: [SRPlay.bundle](https://github.com/henriksp/SRPlay.bundle)

Some additional info. When having multi-part media, even the first part will fail after about 1,5 minutes.

After turn on additional debug in the Plex media center I have been able to find the following problem:



16:28:56 T:2955980800 M: 0% DEBUG: CAnnouncementManager - Announcement: QueueNextItem from xbmc

16:28:56 T:2901484224 M: 0% DEBUG: CFileCache::Open - opening <http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173775.m4a , http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173800.m4a> using cache

16:28:56 T:2901484224 M: 0% WARNING: CreateLoader - Unsupported protocol(stack) in stack://http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173775.m4a , http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173800.m4a

16:28:56 T:2901484224 M: 0% ERROR: Open - failed to open source <stack://http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173775.m4a , http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173800.m4a>

16:28:56 T:2901484224 M: 0% ERROR: Init: Error opening file stack://http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173775.m4a , http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173800.m4a

16:28:56 T:2901484224 M: 0% ERROR: CAudioDecoder: Unable to Init Codec while loading file stack://http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173775.m4a , http://sverigesradio.se/topsy/ljudfil/utan/statistik/4173800.m4a



So the problem looks to be that the created stack of both media parts are given as input and that the FileFactory fails (at the end) to create a handler based on the protocol (should be http but becomes stack due to more than one part).



So it looks like the support for multi-part media is not really in place, or?



I have also included the log file from Plex after enabling additional debug.

While waiting for someone to respond I have done some more debugging.

It looks like the calculation of time when having a stack is incorrect since the following statement in PAPlayer.cpp becomes true:

// check whether we should queue the next file up

if ((GetTotalTime64() > 0) && GetTotalTime64() - GetTime() < TIME_TO_CACHE_NEXT_FILE + m_crossFading * 1000L && !m_cachingNextFile)



This trigger the next file (also a stack) to be cached and then everything goes wrong.



I will continue my debugging…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.