Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MediaPlayer base URL
16-04-2014, 09:42 AM
Post: #1
MediaPlayer base URL
Hi,

Sorry, another stupid question, I seem to be getting good at asking stupid questions..

Is there a way to programatically get the baseURL of the mediaplayer.

The base url is normally something like:

http://192.168.44.1:52821/device-Default...derer/Upnp

I know most of the parameters that make up the base url already, but the port can be a random port and so I was wondering if there was a way to get the full base url string.

I want to use my MediaPlayer to serve a couple of extra images using the writeResources functionality.

Thanks,

Pete.
Find all posts by this user
16-04-2014, 10:05 AM
Post: #2
RE: MediaPlayer base URL
(16-04-2014 09:42 AM)PeteManchester Wrote:  Is there a way to programatically get the baseURL of the mediaplayer.

In most language bindings, yes. For the Java bindings, not yet.

Other bindings pass a IDvInvocation as the first argument to each action. IDvInvocation has a ResourceUriPrefix() function which does exactly what you want.

Java bindings declare IDvInvocation but I can't see it being passed to as part of action invocations. I'm going to be off for the next couple of weeks so won't be able to look at adding this. I'd be very happy to receive a patch implementing this if you fancy having a go Smile.

If you want to have a look at this, I'd start by looking at the template which generates Java providers - ohNet/OpenHome/Net/T4/Templates/DvUpnpJava.tt. Providers can be regenerated via make DvJava uset4=yes
Find all posts by this user
16-04-2014, 10:26 AM
Post: #3
RE: MediaPlayer base URL
(16-04-2014 10:05 AM)simonc Wrote:  
(16-04-2014 09:42 AM)PeteManchester Wrote:  Is there a way to programatically get the baseURL of the mediaplayer.

In most language bindings, yes. For the Java bindings, not yet.

Other bindings pass a IDvInvocation as the first argument to each action. IDvInvocation has a ResourceUriPrefix() function which does exactly what you want.

Java bindings declare IDvInvocation but I can't see it being passed to as part of action invocations. I'm going to be off for the next couple of weeks so won't be able to look at adding this. I'd be very happy to receive a patch implementing this if you fancy having a go Smile.

If you want to have a look at this, I'd start by looking at the template which generates Java providers - ohNet/OpenHome/Net/T4/Templates/DvUpnpJava.tt. Providers can be regenerated via make DvJava uset4=yes

That sounds like a recipe for disaster if I start hacking around at the ohNet code Smile

Have a good holiday..
Find all posts by this user
16-04-2014, 12:58 PM
Post: #4
RE: MediaPlayer base URL
(16-04-2014 10:05 AM)simonc Wrote:  Java bindings declare IDvInvocation but I can't see it being passed to as part of action invocations. I'm going to be off for the next couple of weeks so won't be able to look at adding this. I'd be very happy to receive a patch implementing this if you fancy having a go Smile.

In the Java bindings, action invocation provider methods receive a first argument of type IDvInvocation. The IDvInvocation interface has a getResourceUriPrefix() method.
Find all posts by this user
16-04-2014, 02:09 PM
Post: #5
RE: MediaPlayer base URL
(16-04-2014 12:58 PM)simoncn Wrote:  In the Java bindings, action invocation provider methods receive a first argument of type IDvInvocation. The IDvInvocation interface has a getResourceUriPrefix() method.

So they do, thanks, I was looking in the wrong place before.

Pete, ignore what I said before. You can access the base url from Java bindings just as you would for any other language.
Find all posts by this user


Forum Jump: