FAQ  •  Register  •  Login

Plugin development help

<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Wed Dec 05, 2012 4:40 pm

Plugin development help

Hi All,

I am new to both Serviio and Groovy. So please bear with me if I ask stupid questions.
I have gone through, Serviio Online Resource Plugin Implementation Guide.

I am looking to write a plugin for, http://freeasia.tv/index.html

I have managed to grab the channel list and the channel url.
One of the channel source text looks like this,

---------------------------------------------------------------
<head>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35508473-1']);
_gaq.push(['_setDomainName', 'freeasia.tv']);
_gaq.push(['_trackPageview']);

</script>
</head>

<script type="text/javascript" src="http://freeasia.tv/freetv/silverlight.js"></script>
<script type="text/javascript" src="http://freeasia.tv/freetv/wmvplayer.js"></script>
<div id="dsplayer"></div>
<h3><a href="/index.html">Go back to channel list - Click here </a></h3>

<p>Requirements</p>
<p>*Install Silverlight Player - <a href="http://www.microsoft.com/silverlight/">Click Here</a></p>
<p>*Google Chrome Browser(recommended)</p>
<p>*High Speed Internet connection</p>

<script type="text/javascript">

var cnt = document.getElementById("dsplayer");
var src = "http://freeasia.tv/freetv/wmvplayer.xaml";
var cfg = {height:"430",width:"585",file:"mms://173.193.9.71:86/starvijaydigitalstreams.tv?server_time=12/5/2012 4:26:17 PM&hash_value=huHVtPOTkfuVune0cNogHw==&validminutes=5",overstretch:"fit",showdigits:"false",autostart:"true",linkfromdisplay:"false",repeat:"true",volume:"100",start:"0",windowless:"true",logo:''};
var ply = new jeroenwijering.Player(cnt,src,cfg);
</script>

-------------------------------------------------------------------

The first question I have is, does Serviio support silverlight based pages?

Also, I tried finding the RTMP url through URL Snooper and rtmpsrv, as suggested in the guide, have been unsuccessful.
I suppose not having a basic understanding of streaming content doesn't help but I am willing to learn.

Even if you could suggest other plugin's that parse similar pages that will be great.

Thanks,
Arun
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Dec 05, 2012 4:53 pm

Re: Plugin development help

You can try to use Firefox FireBug / Chrome dev tools to monitor network activity. One of the requests will be for the content URL. Then you can check if you can build the URL from the data you have in the page. If not, search for another request (possibly XML or JSON) made beforehand.. it usually includes some kind of media description and possibly includes the stream URL or values needed to build it.
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Wed Dec 05, 2012 5:03 pm

Re: Plugin development help

Hi,

Thanks for your response.

So, Serviio does support Silverlight? And you think this page can be plugged in?

I use chrome, is there a specific extension that I can use grab the network activity?

I used Chrome's "Dev HTTP Client" it just gave the same information I have copied above.

Thanks,
Arun
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Dec 05, 2012 5:26 pm

Re: Plugin development help

In Chrome just press CTRL + SHITF + I .. and select Network tab

Silverlight .. not sure, depends if FFmpeg can decode it.
<<

r-win

User avatar

DLNA master

Posts: 100

Joined: Sun May 22, 2011 6:16 am

Location: Lelystad, Netherlands

Post Thu Dec 06, 2012 11:01 am

Re: Plugin development help

zip wrote:In Chrome just press CTRL + SHITF + I .. and select Network tab

Didn't know about Ctrl-Shift-I, I always use F12 ;)

mailxarun wrote:So, Serviio does support Silverlight? And you think this page can be plugged in?

Serviio doesn't support Silverlight itself. Silverlight is not a video stream nor a html page, it's a web application framework, which means you can build rich internet applications using Silverlight. This means that it's possible to build a video player in Silverlight, but that doesn't tell you where the stream is coming from. Everybody who uses Silverlight (or Flash, or HTML5) as a player, has to tell the player WHAT to play. You'll be looking for the WHAT...

Anyway, for the Tamil channels, it's pretty easy: you'll need to extract the URL from the HTML page. If you look at the source, you'll see the following near the bottom:

  Code:
 var cfg = {height:"430",width:"585",file:"mms://173.193.9.71:86/tbodigitalstreams.tv?server_time=12/6/2012 10:47:59 AM&hash_value=52PSlpIeBfre9pzIRNWa1g==&validminutes=5",overstretch:"fit",showdigits:"false",autostart:"true",linkfromdisplay:"false",repeat:"true",volume:"100",start:"0",windowless:"true",logo:''};

It tells me the URL (starts with mms://), and that it's valid for 5 minutes (validminutes). So, let Serviio fetch this page in Groovy, find that URL using a regex, and return it. Also, when returning this URL, make sure you change mms:// to mmsh://, because ffmpeg doesn't understand mms://

For some other channels, you'll have to do a bit more, but they all seem to have the stream URL in plain sight ;)
Linksys WRT320N | Samsung PS-50C7700 | Microsoft XBOX 360 | Windows 8.1 | Linux Ubuntu 13.04
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2012 11:06 am

Re: Plugin development help

r-win wrote: Also, when returning this URL, make sure you change mms:// to mmsh://, because ffmpeg doesn't understand mms://

Serviio should do that for you.
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 11:11 am

Re: Plugin development help

Hi r-win,

Thank you so much.

So the content URL that I need to be returning in this instance is,
"mmsh://173.193.9.71:86/tbodigitalstreams.tv?server_time=12/6/2012 10:47:59 AM&hash_value=52PSlpIeBfre9pzIRNWa1g==&validminutes=5"
Is that right?

Is there a way to auto-refresh after 5 minutes? I suppose I could look into other plugins but not sure which one.

Thanks,
Arun
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2012 12:43 pm

Re: Plugin development help

you can set expiry date on each item in the plugin. Look at the iPlayer plugin. That would imply the actual video item expires in 5 minutes though (and won't be available on the web any more). If it's just the particular URL (which might have timestamp sensitive data in it), you can just set expiresImmediately to true.
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 2:09 pm

Re: Plugin development help

Thanks zip.
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 3:02 pm

Re: Plugin development help

Hi Guys,

I just executed ffmpeg (Serviio ffmpeg) to check if the URL's work.

  Code:
arun$ ./ffmpeg -i "mmsh://173.193.9.71:86/starvijaydigitalstreams.tv?server_time=12/6/2012 2:55:49 PM&hash_value=bLfGQ6N/5I2/JsHsR+vKWA==&validminutes=5"
ffmpeg version N-42368-gbf53863 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 10 2012 22:12:54 with gcc 4.0.1 (Apple Inc. build 5493)
  configuration: --enable-static --disable-shared --bindir=/tmp/ffmpeg --disable-ffplay --disable-ffserver --enable-libmp3lame --enable-librtmp --enable-pthreads --disable-mmx --extra-ldflags=-L/tmp/static/lib --extra-cflags=-I/tmp/static/include --extra-libs=-lpolarssl
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 33.100 / 54. 33.100
  libavformat    54. 15.102 / 54. 15.102
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  1.100 /  3.  1.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
[http @ 0xe3c020] HTTP error 400 Bad Request
mmsh://173.193.9.71:86/starvijaydigitalstreams.tv?server_time=12/6/2012 2:55:49 PM&hash_value=bLfGQ6N/5I2/JsHsR+vKWA==&validminutes=5: Input/output error


Does that mean I won't be able to plug this website?

Thanks,
Arun
<<

r-win

User avatar

DLNA master

Posts: 100

Joined: Sun May 22, 2011 6:16 am

Location: Lelystad, Netherlands

Post Thu Dec 06, 2012 3:50 pm

Re: Plugin development help

Well, in this case it means you didn't encode the Url. Google that :-)

If it fails after you've done that, you might be out of luck. By the way, I'm also curious what happens if you set the minutes from 5 to an insanely high number :-)
Linksys WRT320N | Samsung PS-50C7700 | Microsoft XBOX 360 | Windows 8.1 | Linux Ubuntu 13.04
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 4:09 pm

Re: Plugin development help

Hi r-win,

Thanks for that. Here's the output.

  Code:
arun$ ./ffmpeg -i "mmsh://173.193.9.71:86/starvijaydigitalstreams.tv?server_time=12/6/2012%203:57:53%20PM&hash_value=pxUUjZfah/6MeQNXcPu7SA==&validminutes=5"
ffmpeg version N-42368-gbf53863 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 10 2012 22:12:54 with gcc 4.0.1 (Apple Inc. build 5493)
  configuration: --enable-static --disable-shared --bindir=/tmp/ffmpeg --disable-ffplay --disable-ffserver --enable-libmp3lame --enable-librtmp --enable-pthreads --disable-mmx --extra-ldflags=-L/tmp/static/lib --extra-cflags=-I/tmp/static/include --extra-libs=-lpolarssl
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 33.100 / 54. 33.100
  libavformat    54. 15.102 / 54. 15.102
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  1.100 /  3.  1.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
[wmv3 @ 0x10b7800] Extra data: 8 bits left, value: 0
[asf @ 0x1086a00] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, asf, from 'mmsh://173.193.9.71:86/starvijaydigitalstreams.tv?server_time=12/6/2012%203:57:53%20PM&hash_value=pxUUjZfah/6MeQNXcPu7SA==&validminutes=5':
  Metadata:
    title           : Vijay tv
    artist          : Star TV Network
    copyright       : Channellive.tv
    WMFSDKVersion   : 11.0.5358.4827
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
  Duration: N/A, start: 312614.437000, bitrate: 996 kb/s
    Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, s16, 96 kb/s
    Stream #0:1(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 720x576, 900 kb/s, 25 tbr, 1k tbn, 1k tbc
At least one output file must be specified


Does Serviio support WMV3?
According to this wiki (http://wiki.serviio.org/doku.php?id=add_live_feeds) it's not supported. Am I out of luck?

Setting validminutes to anything other than 5 results in an input/output error.
I don't quite understand, if that means I can only stream it for 5 minutes. If that's the case I certainly don't understand how to auto-refresh.

Appreciate your help on this.

Thanks,
Arun
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 5:29 pm

Re: Plugin development help

Hi Guys,

Just an update. I was able to add the mmsh URL in Serviio console as a live-stream and play it.

But after some time it does expire. Not exactly in 5 minutes.
I suppose 5 minutes is the amount of time the video is allowed to buffer and that's why the TV stream expires way after 5 mins.
That's just a wild guess though.

As I said earlier, a different value set as validminutes other than 5, throws an error.
As suggested by zip will look into the iPlayer plugin.
Does the iPlayer plugin show you how to auto-refresh the link?
Any help around auto-refresh is welcome.

I will still have to write the plugin to scrape the URL.

Thanks,
Arun
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2012 5:35 pm

Re: Plugin development help

It'll autorefresh autmatically on the expiration date you provide. But I think setting expiresImmediately to true should do the trick instead.
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 6:05 pm

Re: Plugin development help

Hi zip,

Is expiresImmediately=true a value that should be set in the URL?
In that case will my URL looks like this?
"mmsh://173.193.9.71:86/starvijaydigitalstreams.tv?server_time=12/6/2012%203:57:53%20PM&hash_value=pxUUjZfah/6MeQNXcPu7SA==&validminutes=5&expiresImmediately=true"

Or is this a setting that's set in the Plugin so that the server knows to execute the plugin again, if it needs a refresh?

Sorry I am sounding more and more stupid as the thread progresses :lol:

Thanks,
Arun
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2012 8:02 pm

Re: Plugin development help

did you read the plugin guide? It's one of the attributes you can set on the returned URL object (not the URL itself) returned from the plugin.
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 10:01 pm

Re: Plugin development help

Hi,

Sorry, read the manual again. And it's very clear how to use expiresImmediately.

Have sorted it out and managed to get the plugin working. But there is an issue though.

The video does stutter and stop for a while, this happens both on the TV (Samsung D series) and in the VLC player.
For some reason the TV decides to skip to the next channel, when the pause is a bit more, whereas VLC player pauses for that much more and starts playing the video again.

Is there some sort of timeout setting? Can this be manipulated?

Thanks,
Arun
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2012 10:29 pm

Re: Plugin development help

No. Can you play the mms in VLC without any interruptions? Do you have a recent FFMpeg version?
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 10:42 pm

Re: Plugin development help

Hi zip,

VLC does have interruptions but it continues playing the same channel after a pause. Whereas on the TV it skips to the next available channel on the channel list.

Thanks,
Arun
<<

mailxarun

Serviio newbie

Posts: 14

Joined: Mon Dec 03, 2012 10:20 am

Post Thu Dec 06, 2012 10:46 pm

Re: Plugin development help

Also, I only downloaded Serviio 3-4 days back, I assuming I have the latest FFMpeg version.

The version is
ffmpeg version N-42368-gbf53863
Next

Return to Plugin development

Who is online

Users browsing this forum: No registered users and 11 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.