2021-05-10, 22:51
Hi there,
I'm trying to include youtube with my custom add-on. but it closes the Kodi when I play the video
I have main menu and second menu and the play video. whenever I click on play item, it's not playing.anyone knows why?
this is my simplified code
there's no log available. don't know how to debug this.
My OS is Mac/Kodi19
I'm trying to include youtube with my custom add-on. but it closes the Kodi when I play the video
I have main menu and second menu and the play video. whenever I click on play item, it's not playing.anyone knows why?
this is my simplified code
python:
import sys, xbmc, xbmcgui, xbmcplugin
import urllib
URL = 'https://www.youtube.com/watch?v=aqz-KE-bpKQ'
URL = 'plugin://plugin.video.youtube/play/?video_id=aqz-KE-bpKQ'
def run(addon_url):
if addon_url.endswith('/directory'):
xbmcplugin.setContent(int(sys.argv[1]), 'movies')
title = 'One more Directory'
image = 'https://peach.blender.org/wp-content/uploads/poster_bunny_small.jpg'
listitem = xbmcgui.ListItem(label=title)
listitem.setProperty('IsPlayable', 'true')
listitem.setArt({'thumb': str(image),
'icon': str(image),
'poster': str(image),
'fanart': str(image)})
url = addon_url + '/play?mode=test2'
xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
elif addon_url.endswith('/play'):
stream_url = URL
title = 'Bigbuck bunny'
listitem = xbmcgui.ListItem(path=stream_url)
listitem.setProperty('IsPlayable', 'true')
listitem.setInfo('video', {'Title': title, 'Genre': 'Cartoon'})
xbmc.Player().play(stream_url, listitem)
else:
"""Main Loading
"""
xbmcplugin.setContent(int(sys.argv[1]), 'movies')
title = 'First Directory'
image = 'https://upload.wikimedia.org/wikipedia/commons/c/c5/Big_buck_bunny_poster_big.jpg'
listitem = xbmcgui.ListItem(label=title)
listitem.setProperty('IsPlayable', 'true')
listitem.setArt({'thumb': str(image),
'icon': str(image),
'poster': str(image),
'fanart': str(image)})
url = addon_url + '/directory?mode=test2'
xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
run(sys.argv[0])
there's no log available. don't know how to debug this.
My OS is Mac/Kodi19