TwitchTV

Hi,



I have just started with Channel Development and I wanted to try to make a plugin for TwitchTV. I far as I can understand it should be possible to make such a plugin. However, I find it kind of difficult to find out how to do this. I have been reading through a lot of forum posts and also the documentation, but as I do not have that much web coding(or python) experience I do not think I understand what I need to do. I do not really know what my question should be, but I will try to do my best coming up with a question that makes half-sense.



Do I need a site configuration for a TwitchTV Live stream? I have tried with this:


<site site="http://no\.twitch\.tv"<br />
plugin="plugin="http://www-cdn\.jtvnw.net/widgets/live_site_player.*\.swf"<br />
initialState="playing"<br />
version="1.0"><br />
<crop x="0" y="0" width="0" height="0" /><br />
<br />
        <!-- PLAYING --><br />
        <state name="playing"><br />
                <event><br />
                        <condition><br />
                                <command name="pause" /><br />
                        </condition><br />
                        <action><br />
                                <click x="15" y="304" /><br />
                                <goto state="paused" /><br />
                        </action><br />
                </event><br />
        </state><br />
<br />
        <!-- PAUSED --><br />
        <state name="paused"><br />
                <event><br />
                        <condition><br />
                                <command name="play" /><br />
                        </condition><br />
                        <action><br />
                                <click x="15" y="304" /><br />
                                <goto state="playing" /><br />
                        </action><br />
                </event><br />
        </state><br />
</site>



I do not know if I should have the http:// in front of the site and plugin tag or not. In the channel code I have been copying and pasting from different examples I have found and ended up trying with this:

NAME = "TwitchTEST"<br />
URL = "http://www-cdn.jtvnw.net/widgets/live_site_player.r8aecbbcea76a272aa00ed8966e40dafbbdb62ccf.swf"<br />
WIDTH = 620<br />
HEIGHT = 378 <br />
<br />
ART = 'art-default.png'<br />
ICON = 'icon-default.png'<br />
<br />
<br />
def Start():<br />
<br />
    # Initialize the plugin<br />
    Plugin.AddPrefixHandler(VIDEO_PREFIX, MainMenu, NAME, ICON, ART)<br />
    Plugin.AddViewGroup("List", viewMode = "List", mediaType = "items")<br />
    Plugin.AddViewGroup("MyDetailViewGroupName", viewMode="InfoList")<br />
    # Setup the artwork associated with the plugin<br />
    MediaContainer.title1 = NAME<br />
    MediaContainer.viewGroup = "List"<br />
    MediaContainer.art = R(ART)<br />
    DirectoryItem.thumb = R(ICON)<br />
    DirectoryItem.art = R(ART)<br />
    VideoItem.thumb = R(ICON)<br />
    VideoItem.art = R(ART)<br />
<br />
# This main function will setup the displayed items.<br />
def MainMenu():<br />
    dir = MediaContainer(viewMode= "List")<br />
    dir.Append(Function(DirectoryItem(LiveMenu, "Live")))<br />
    return dir<br />
<br />
def LiveMenu(sender):<br />
    dir = MediaContainer(viewMode = "List")<br />
    dir.Append(Function(WebVideoItem(MediaContainerTest, title="TwitchTest", subtitle=None, thumb=None), url=URL))<br />
<br />
    return dir<br />
<br />
def MediaContainerTest(sender, url):<br />
    dir = MediaContainer()<br />
    Log(url)<br />
    return Redirect(WebVideoItem(url))



In the Plex Media Server.log I get this error:

Dec 08, 2012 23:28:28:732 [8008] DEBUG -  * url => http://www-cdn.jtvnw.net/widgets/live_site_player.r8aecbbcea76a272aa00ed8966e40dafbbdb62ccf.swf<br />
Dec 08, 2012 23:28:28:733 [8008] DEBUG -  * prefix => /video/example<br />
Dec 08, 2012 23:28:28:733 [8008] DEBUG - WebKit: [www-cdn.jtvnw.net/widgets/live_site_player.r8aecbbcea76a272aa00ed8966e40dafbbdb62ccf.swf]<br />
Dec 08, 2012 23:28:28:733 [8008] DEBUG - Found corresponding plug-in: C:\Users\User\AppData\Local\Plex Media Server\Plug-in Support\Data
o.user.plugins.twitchtv<br />
Dec 08, 2012 23:28:28:733 [8008] DEBUG - Could not find site configuration for http://www-cdn.jtvnw.net/widgets/live_site_player.r8aecbbcea76a272aa00ed8966e40dafbbdb62ccf.swf<br />
Dec 08, 2012 23:28:28:733 [8008] ERROR - ERROR: Couldn't find configuration.<br />
Dec 08, 2012 23:28:28:733 [8008] ERROR - WebKit: Could not initiate capture.



Am I totally off here? I kinda find it hard to find out how I should do this. I will be grateful for any suggestions:)

So after some frustration I found out that my site configuration was actually placed in the wrong place:/ Now its picked up and Plexs seems to be able to pick up on the .swf file from the twitch site. I also found out that it is the actual page and not the .swf url that should be loaded in the webvideoitem. Not trivial for me to know.



Dec 09, 2012 22:42:04:234 [1648] DEBUG - Plugin loaded (application/x-shockwave-flash, , 7E380340, 0, 1555, 300, 150, )<br />
Dec 09, 2012 22:42:04:234 [1648] DEBUG - WebKit: 7E380340 Plugin loaded [] (0 1555 300 150 )<br />
Dec 09, 2012 22:42:04:324 [1648] DEBUG - Plugin loaded (application/x-shockwave-flash, http://www-cdn.jtvnw.net/widgets/live_site_player.r8aecbbcea76a272aa00ed8966e40dafbbdb62ccf.swf, 7E217090, 33, 242, 620, 378, live_site_player_flash)<br />
Dec 09, 2012 22:42:04:324 [1648] DEBUG - WebKit: 7E217090 Plugin loaded [www-cdn.jtvnw.net/widgets/live_site_player.r8aecbbcea76a272aa00ed8966e40dafbbdb62ccf.swf] (33 242 620 378 live_site_player_flash)<br />
Dec 09, 2012 22:42:04:366 [1648] DEBUG - WebKit: Frame was loaded, processing event.<br />
Dec 09, 2012 22:42:04:366 [1648] DEBUG - WebKit: Frame was loaded, processing event.<br />
Dec 09, 2012 22:42:05:313 [1648] DEBUG - WebKit: Received title [Facebook].<br />
Dec 09, 2012 22:42:05:517 [1648] DEBUG - WebKit: Received title [Twitter Tweet Button].<br />
Dec 09, 2012 22:42:06:505 [1648] DEBUG - WebKit: Received title [Tweet Button].



From the log it seems that the player is found, but inside plex the message box with "Opening Stream" just hangs and nothing ever happens. Any suggestions?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.