Playing Youtube links in XBMC

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
DoubleT Offline
Senior Member
Posts: 117
Joined: Dec 2005
Reputation: 1
Post: #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.
find quote
DoubleT Offline
Senior Member
Posts: 117
Joined: Dec 2005
Reputation: 1
Post: #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?
(This post was last modified: 2014-05-07 15:10 by DoubleT.)
find quote
DoubleT Offline
Senior Member
Posts: 117
Joined: Dec 2005
Reputation: 1
Post: #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.
find quote
Pline Offline
Junior Member
Posts: 28
Joined: Nov 2013
Reputation: 3
Post: #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')
(This post was last modified: 2014-05-08 06:01 by Pline.)
find quote