2018-09-22, 13:14
Originally I thought you had to assemble the Playlist after Play()-ing an item, but no. You're supposed to add items to the video Playlist while listing your directory, not on a "resolve" or playback function:
Then while viewing the directory, the user can press LEFT (sometimes UP depending on the layout mode) to open the settings sideblade where they can choose "Actions: Go To Playlist" to view the playlist that you set up, where they can choose shuffle, repeat one/all/off, etc. and play the items in the list.
The documentation wasn't clear on how to use it, I understood it after seeing the YouTube add-on.
Have a good one.
--------------------------------
This is a continuation of a previous thread, I created the first one in the wrong area: https://forum.kodi.tv/showthread.php?tid=334889
This is the right way to do it.python:myPlaylist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) # Get a reference to the "current video playlist", as they call it.
myPlaylist.clear() # Clear it (in case it already had content).
# (...)
# Then while creating your directory items:
myItem = xbmcgui.ListItem(name)
myItem.setArt({...})
myItem.setInfo('video', infoLabels={...})
myItem.setProperty('IsPlayable', 'true')
myPlaylist.add(myUrl, myItem) # <------- Add to the playlist.
xbmcplugin.addDirectoryItem(int(sys.argv[1]), url = myUrl, listitem = myItem, isFolder = False) # Or addDirectoryItems() all of them at once.
xbmcplugin.endOfDirectory(int(sys.argv[1]))
Then while viewing the directory, the user can press LEFT (sometimes UP depending on the layout mode) to open the settings sideblade where they can choose "Actions: Go To Playlist" to view the playlist that you set up, where they can choose shuffle, repeat one/all/off, etc. and play the items in the list.
The documentation wasn't clear on how to use it, I understood it after seeing the YouTube add-on.
Have a good one.
--------------------------------
This is a continuation of a previous thread, I created the first one in the wrong area: https://forum.kodi.tv/showthread.php?tid=334889