Youtube Play url is not working
#1
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

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
Reply
#2
This would be better in addon development - moving it there.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

My Blog Posts
Reply



Logout Mark Read Team Forum Stats Members Help
Youtube Play url is not working0
This forum uses Lukasz Tkacz MyBB addons.