Opening stream dialog stays open when playing queued item and playback crashes
#1
Hi,

I have a strange error when playing queued item from my addon. The addon works perfectly when clicking on the item in folder menu, but when the same item is queued using context menu then the opening stream dialogue is shown which won't disappear and after around 20 seconds or so video playback crashes - one or more items failed to play, check log... The same happens when I cancel the dialog.

Code used to queue the item:
Code:
listItem=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage);
listItem.setInfo( type="Video", infoLabels={ "title": name, "plot": desciption} );
listItem.addContextMenuItems([(addon.getLocalizedString(55572), "XBMC.Action(Queue)",)], True );
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listItem);


Code used to play items:

Code:
if (self.play and self.pDialog != None) and self.downloadedFiles < 4:
            if self.downloadedFiles == 1:
                if self.pDialog:
                    self.pDialog.update(50);
            if self.downloadedFiles == 2:
                if self.pDialog:
                    self.pDialog.update(70);
            if self.downloadedFiles == 3:
                if self.pDialog:
                    self.pDialog.update(100);
                    self.pDialog.close();
                    xbmc.sleep(20);
                if self.play:
                    listitem = xbmcgui.ListItem(label = self.displayName, path = self.playListFile);
                    listitem.setProperty("Video", "true" )
                    listitem.setInfo('Video', {'Title': self.displayName})
                    listitem.setProperty('IsPlayable', 'true')
                    xbmc.Player().play(self.playListFile, listitem);
Let me explain a bit this code. The entire stream is segmented to 10 seconds files which I have to download (reason is here). Before download with playback starts, a progress dialog is shown and it is updated till 3rd file is downloaded (around 2 seconds). Then progress dialogue is closed and playback starts using generated local m3u8 playlist pointing to .ts files in local dir.

As I mention, this works great when playback is started directly from addon's folder structure. As soon as queued item is played after around 20 seconds playback crashes while showing opening stream dialog.

Debug log can be found here - playback of normally played item starts around line 276 and of crashed item on line 1409.

I already tried what was discused here, it seams that it is not solved.

Any advice would be much appreciated.
Reply
#2
I was able to solve my issue. After reading entire pythom api couple of times, I noticed one method - xbmcplugin.setResolvedUrl(). Then I found this nice thread where this method was explained. Afterwards I knew that I didn't have the right approach to playing the stream.

As item to be played was an url pointing to the addon, xbmc was expecting xbmcplugin.setResolvedUrl() which I was not using, instead I used xbmc.Player().play(). After I used setResolvedUrl() and added listitem.setProperty('IsPlayable', 'true'), when folder was generated, the issue was solved.
Reply

Logout Mark Read Team Forum Stats Members Help
Opening stream dialog stays open when playing queued item and playback crashes0