[REQUEST] TVNZ OnDemand Video Plugin - Watch New Zealand Television?

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
WaterGoblin Offline
Junior Member
Posts: 2
Joined: Feb 2012
Reputation: 0
Post: #181
I threw that PS3 flash player into http://www.showmycode.com/

They are using a service called Brightcove Player, which looks to have an API that is generating the URLs (can't see it being done in the flash code)

When I get some more time I'll try running a packet sniffer and see the communication that is going on to Brightcove API. There are a few other topics on this site that mention brightCove..

http://www.brightcove.com/brightcoveplayerapi
http://c.brightcove.com/services

Code:
_local2.playerKey = "AQ~~,AAAA4FQHurk~,l-y-mylVvQmMeQArl3N6WrFttyxCZNYX";
_local2.playerID = 1257248093001;
find quote
WaterGoblin Offline
Junior Member
Posts: 2
Joined: Feb 2012
Reputation: 0
Post: #182
Those numbers you pulled out of the URL, the first number is the SitePublisherID - so is probably the same for all TVNZ stuff.
SitePublisherID = 963482467001
EDIT - digging around in the federatedVideo/BrightcovePlayer.swf, there may be several TVNZ publisher IDs.
TVNZ_PUBLISHER_IDS:Array = [963482464001, 963482467001, 945142951001, 742378304001, 1101631991001]

The other number is the SiteVideoID which seems to be very mysterious to generate.
SiteVideoID = 1461543813001

Here is a URL which will let you play any TVNZ video
Where you see 'videoPlayer=ref%3A' - just replace 4732141 with the episode ID (which can be found in the URL to any specific episode), or the XML files you identified earlier.

If you put that URL into RTMPDump it seems to extract an FLV file successfully, but not sure if that is helpful.

Code:
http://admin.brightcove.com/viewer/us20120221.1317/BrightcoveBootloader.swf?playerID=1257248093001&playerKey=AQ~~%2CAAAA4FQHurk~%2Cl-y-mylVvQmMeQArl3N6WrFttyxCZNYX&%40videoPlayer=ref%3A4732141&autoStart=&bgcolor=%23FFFFFF&debuggerID=&flashID=myPlayer&height=412&isVid=true&showNoContentMessage=&width=486


The BrightcoveBootloader.swf then passes a bunch of parameters through to
Code:
http://admin.brightcove.com/viewer/us20120221.1317/federatedVideo/BrightcovePlayer.swf

I think that BrightcovePlayer.swf is where it works out the RTMP URL. I've had a look through the decompiled code but haven't managed to spot anything too exciting.. it seems like it may have to set a special cookie or something which then allows the flash player to access the Brightcove API and get the RTMP URL.



FYI, if it helps anyone else investigating, this code will let you embed any video in an html file. Just change the number in the @videoPlayer field to change to a different video.
Code:
<html>
<head></head>
<body>
<script  language="JavaScript" type="text/javascript" src="
http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
<object id="myPlayer"  class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="playerID" value="1257248093001" />
<param name="playerKey" value="AQ~~,AAAA4FQHurk~,l-y-mylVvQmMeQArl3N6WrFttyxCZNYX" />
<param name="isVid" value="true" />
<param name="overrideAds" value="true" />
<param value="ref:4732141" name="@videoPlayer" />
</object>
</body>
</html>


There are some other calls going off to Tubemogul with Cookies and JSON but not sure if they are important or just for some sort of metrics.
(This post was last modified: 2012-02-23 04:37 by WaterGoblin.)
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #183
Hi WaterGoblin. Thanks for the pointers so far - I'm just trying to finish off the new version of this plugin, and I'm now looking at TVNZ. If you're right about RTMPDump being able to play from that URL, I'll have a look at if I can get XBMC to hand the HTTP URL to rtmp, rather than have XBMC try to play the URL directly.

As an aside, I've managed to get NZOnScreen working now. So we have working Ziln, NZOnScreen, Parliament TV and Shine TV in my new code. I've yet to finish off converting TV3 to use the new plugin structure (pretty much everything's class-based now), and TVNZ is my current challenge.

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #184
WaterGoblin, how exactly did you feed that URL into rtmpdump? Can you give me the full command you ran?

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #185
Looks like I might have hit a dead end with the new TVNZ steams, at least for now. They appear to be using a newer version of RTMP than is supported by rtmpdump. Here's the command I've just tried to run to grab a stream:

Code:
rtmpdump -r "rtmpe://cp133145.edgefcs.net/ondemand/&mp4:videos/963482467001/963482467001_1496686975001_4769206.mp4" -W "http://admin.brightcove.com/viewer/us20120319.1412/federatedSlim/BrightcovePlayer.swf" -o Test2.flv

And here's the output:

Code:
RTMPDump 2.4 git-6230845 2011-9-25
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
WARNING: HandShake: Type mismatch: client sent 6, server answered 9
INFO: Connected...
ERROR: HandleCtrl: SWFVerification Type 2 request not supported! Patches welcome
...
ERROR: Closing connection: NetStream.Play.StreamNotFound

It seems like the first warning is okay, as protocol version 9 is supported by rtmpdump, but the ERROR is because the new type of Flash Verification (type 2) hasn't been coded in rtmpdump yet.

For now I guess I'll keep trying to find out how to build the RTMP URLs, as hopefully someone will add the new verification type to rtmpdump at some point. My only other major work is to fix up the TV3 stuff and then I'll release the Eden version of the plugin.

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
dteirney Offline
Team-XBMC Developer
Posts: 830
Joined: Jul 2007
Reputation: 6
Location: New Zealand
Post: #186
You could try the following patch to your librtmp and see if the server still works when using Type 1. http://lists.mplayerhq.hu/pipermail/rtmp...01578.html

Use MythTV for recording TV? Try the integrated MythTV support in XBMC Media Center. Now with commercial skip support built-in and integration with the Movie database!
find quote
dteirney Offline
Team-XBMC Developer
Posts: 830
Joined: Jul 2007
Reputation: 6
Location: New Zealand
Post: #187
Actually, this patch is clearer. http://lists.mplayerhq.hu/pipermail/rtmp...01581.html

Use MythTV for recording TV? Try the integrated MythTV support in XBMC Media Center. Now with commercial skip support built-in and integration with the Movie database!
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #188
Dave, thanks - I'll try that patch when I get the chance. My priority now, though, is to clean up the plugin a bit and get it released - especially as Eden is out already!

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #189
I'm still trying to work out how to get the RTMP URL from TVNZ, and while poking around found that the PS3 site (http://tvnz.co.nz/ondemand/xl) grabs a page from a message broker that's kind of weird:

http://c.brightcove.com/services/messagebroker/amf

The page title is "gobbles!" and the page is full of the following:

Quote:This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat. This turkey likes to eat.

I assume that the page contents don't matter, and that it's the data in the HTTP request to the server that's important (including a GET variable called playerKey that I've removed from the link above). Still, it's a bit of light relief from trying to work out how to build these damned URLs, which is beginning to feel like I'm banging my head against a brick wall.

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
dethfeet Offline
Junior Member
Posts: 21
Joined: Mar 2012
Reputation: 2
Post: #190
Hi,

I did not follow the whole thread and I'm outside of NZ. But I created a plugin for german TV station using the brightcove api.

You need to send an amf request to retrieve the url (using pyamf). I copied the code to do this from this plugin:
http://code.google.com/p/bluecop-xbmc-re...n303&r=303

You can see my plugin for reference here:
http://code.google.com/p/xbmc-dethfeet/s...default.py

Maybe this helps you...
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #191
Wow, thanks! I'll give this a try and see if I can grab the URL by hand, and if it works I'll code it in to my plugin.

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
nickr Offline
Donor
Posts: 9,011
Joined: May 2009
Reputation: 163
Location: Christchurch NZ
Post: #192
Hi there Mark and the others in this thread.

I became aware on nzonscreen through a radio item on RNZ National during the weekend and immediately started to look for how to integrate it with XBMC. Google led me to this thread.

So is there any progress with that?

Cheers, Nick.

If I have helped you or increased your knowledge, click the plus button and increase my reputation :)
(This post was last modified: 2012-04-16 09:41 by nickr.)
find quote
Stildawn Offline
Senior Member
Posts: 182
Joined: May 2012
Reputation: 0
Post: #193
I to would like to know if there is any progress?

And if so how to do it, I'm a complete XBMC noob lol.

Much thanks
(This post was last modified: 2012-05-30 01:04 by Stildawn.)
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #194
I'm back to working on this, now that I've finished moving house, etc.

I've found that there is a brightcove module for XBMC that I'm going to try to use, and I've also packaged up PyAMF for XBMC and will be releasing this alongside the TVNZ plugin for Eden. I'll try to be done for the end of the weekend, and will release even if I can 't get the TVNZ brightcove content playing.

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
markhoney Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Location: Wellington, New Zealand
Post: #195
Hah, I think I've found my problem - PyAMF needs a fix, as documented at:

http://forum.xbmc.org/showthread.php?tid=119551&page=5

I seem to be getting useful data back from BrightCove now, so all I need to do is decode the data, extract the RTMP URL and hopefully TVNZ will be working an a couple of hours!

Author of the NZ OnDemand and ZoneMinder addons, and caretaker of the pyamf script. Contributor to fanart.tv, TheMovieDB and TheTVDB.
find quote
Post Reply