Playing Youtube links in XBMC
#1
Im putting together a basic plugin for a friend, it will be a static list of Youtube links.
So far i am unable to get youtube links to play in XBMC,

should i be importing the youtube addon within my own in order to prepare the videos for viewing, or should they just play if i have the correct URL?

this is where i am at currently

Code:
import sys
import xbmcgui
import xbmcplugin

addon_handle = int(sys.argv[1])

xbmcplugin.setContent(addon_handle, 'movies')

url = 'plugin://plugin.video.youtube/?action=play_video&videoid=GgTpAPdwmbU'
li = xbmcgui.ListItem('Addison Groove Tribute', iconImage='http://www.residentadvisor.net/images/reviews/2012/addison-groove-transistor-rhythm.jpg', thumbnailImage='http://www.residentadvisor.net/images/reviews/2012/addison-groove-transistor-rhythm.jpg')
li.setProperty('fanart_image', 'fanart.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)

xbmcplugin.endOfDirectory(addon_handle)

Any advice would be much appreciated.
Reply
#2
So looking through other plugins, ive found that i need to translate the URL before sending it onto XBMC

This link:

http://r5---sn-cg07luee.googlevideo.com/...=m&mws=yes

Content wise, Is the same as this link:

plugin://plugin.video.youtube/?action=play_video&videoid=GgTpAPdwmbU

which was grabbed from youtube as

https://www.youtube.com/embed/GgTpAPdwmbU

Trying to work out how to convert from one to the other.
Any ideas?
Reply
#3
Quote:You can use the Youtube addon:
Code:
url = "plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=YOUTUBE_VIDEO_ID"
Really banging my head against a brick wall now
Every example i find on the forum doesnt work anymore.

But i can play the videos using YouTube or YouTube Channels plugins. Even replicating the path to a working video doesnt work.
Reply
#4
What version of the YouTube add-on are you using? I have 4.4.6 from The Collective and this works fine for me:

Code:
plugin://plugin.video.youtube/?action=play_video&videoid=VIDEO_ID

(Granted, I used it from a context menu, so it's wrapped with PlayMedia(), but you wouldn't need to do that.)

EDIT: You may also need to set

Code:
li.setProperty('IsPlayable', 'true')
Reply

Logout Mark Read Team Forum Stats Members Help
Playing Youtube links in XBMC0