communicating between a DMS and DMR using iPhone DMC

643 views
Skip to first unread message

sudheer dantuluri

unread,
Oct 7, 2011, 1:42:40 AM10/7/11
to upnpx
Hi Bruno,

I'm developing an application using the upnpx library for iOS.
Followed the demo app and now I'm able to browse the contents of DMS
and also render the content as well in my application. Now I'm
planning to render the content of a DMS to a DMR (Digital Media
Renderer) (eg., rendering a video of a DMS on a DLNA enabled renderer
such as a DLNA TV) using my iPhone DMC.

It would be great if you can provide me a link or some sample code
which could give a detailed information as how to send a request to
DMR with the information required to render the DMS content.

Thanks
Sudheer

Bruno Keymolen

unread,
Oct 7, 2011, 9:32:20 AM10/7/11
to up...@googlegroups.com
Hi Sudheer,

I plan to extend the demo with this functionality.


Thanks,

Sent from my iPhone

sudheer dantuluri

unread,
Oct 9, 2011, 1:24:39 PM10/9/11
to up...@googlegroups.com
Hi Bruno,

Thanks for the great work that you have been doing for upnpx library for iOS. Also thanks for planning to extend the demo with the functionality required. Meanwhile can you help in providing a link or steps to follow which can help me achieving the functionality. I'll try to give a trail from my end.

Thanks once again for the lib upnpx support.

Have a nice day...

bye
Sudheer

Bruno Keymolen

unread,
Oct 9, 2011, 1:34:54 PM10/9/11
to up...@googlegroups.com
Hi Sudheer,

In brief:

You need to have:

- the URI to play (that you find in MediaServer1ItemObject, see demo to get the objects) 
- the renderer, which is a MediaRenderer1Device (you find renderers in the same way as MediaServer1Device's, see demo).

To play media you can use the AVTransport service commands like this:

    [[renderer avTransport] SetAVTransportURIWithInstanceID:@"0" CurrentURI:[mediaItem uri] CurrentURIMetaData:@"" ]; 

    [[renderer avTransport] PlayWithInstanceID:@"0" Speed:@"1"];


Check the UPnP specs for the full set of available commands and their (and the parameters) specific meaning. 

For the above AVTransport service, the specifications can be found here : http://www.upnp.org/specs/av/UPnP-av-AVTransport-v1-Service.pdf


Kind regards,


Bruno

sudheer dantuluri

unread,
Oct 10, 2011, 1:07:33 AM10/10/11
to up...@googlegroups.com
Hi Bruno,

Thank you very much for the support. I'll try and update you with the status. 

Thanks
Sudheer

sudheer dantuluri

unread,
Oct 10, 2011, 6:33:42 AM10/10/11
to up...@googlegroups.com
Hi Bruno,

Followed the steps mentioned by you and I'm able to play a DMS content on to a DMR using iPhone DMC. Great. Thanks a lot.

Thanks
Sudheer

sudheer dantuluri

unread,
Oct 11, 2011, 6:17:30 AM10/11/11
to upnpx
Hi Bruno,

Is there any method in SoapActionsAVTransport1 class to control the
volume of a DMR using an iPhone DMC client? If so, please let me know.
Now I'm able to play, pause and stop a video.

Thanks
Sudheer

On Oct 10, 3:33 pm, sudheer dantuluri <dantuluri.sudh...@gmail.com>
wrote:
> Hi Bruno,
>
> Followed the steps mentioned by you and I'm able to play a DMS content on to
> a DMR using iPhone DMC. Great. Thanks a lot.
>
> Thanks
> Sudheer
>
> On Mon, Oct 10, 2011 at 10:37 AM, sudheer dantuluri <
>
>
>
> dantuluri.sudh...@gmail.com> wrote:
> > Hi Bruno,
>
> > Thank you very much for the support. I'll try and update you with the
> > status.
>
> > Thanks
> > Sudheer
>
> >>> On Fri, Oct 7, 2011 at 7:02 PM, Bruno Keymolen <bruno.keymo...@gmail.com
> >>> > wrote:
>
> >>>> Hi Sudheer,
>
> >>>> I plan to extend the demo with this functionality.
>
> >>>> Thanks,
>
> >>>> Sent from my iPhone
>
> >>>> On Oct 7, 2011, at 1:42, sudheer dantuluri <dantuluri.sudh...@gmail.com>

Bruno Keymolen

unread,
Oct 11, 2011, 8:34:29 AM10/11/11
to up...@googlegroups.com


Volume is set in RenderingControl, not in AVTransport.

A standard device have 3 services (R is required, O is optional):

  • RenderingControl:1.0 R 
  • ConnectionManager:1.0 R 
  • AVTransport:1.0 O  

See 2.2 in: http://www.upnp.org/specs/av/UPnP-av-MediaRenderer-v1-Device.pdf


Volume can be set with "RenderingControl".

See the action "SetVolume" at 2.4.30. in : http://www.upnp.org/specs/av/UPnP-av-RenderingControl-v1-Service.pdf


In upnpx it will be something like this: 

int v = 50;

[[device renderingControl] SetVolumeWithInstanceID:@"0" Channel:@"Master" DesiredVolume:[NSString stringWithFormat:@"%d", (int)v] ];



Regards,

Bruno

Bao Bui

unread,
Oct 11, 2011, 11:51:49 PM10/11/11
to upnpx
Hi everybody,
For some reasons, when I use uri from [mediaitem uri], I get an error
<The reference to entity "infokey" must end with the ';' delimiter>.
To fix this error:
NSString* itemURI = [mediaitem uri];
itemURI = [itemURI stringByReplacingOccurrencesOfString:@"&"
withString:@"&amp;"
Note that I use cling-mediarenderer for simulate a mediarender.
Best regards,
Bao Bui

On Oct 11, 7:34 pm, Bruno Keymolen <bruno.keymo...@gmail.com> wrote:
> Volume is set in RenderingControl, not in AVTransport.
>
> A standard device have 3 services (R is required, O is optional):
>
>    - RenderingControl:1.0 R
>    - ConnectionManager:1.0 R
>    - AVTransport:1.0 O
>
> See 2.2 in:http://www.upnp.org/specs/av/UPnP-av-MediaRenderer-v1-Device.pdf
>
> Volume can be set with "RenderingControl".
>
> See the action "SetVolume" at 2.4.30. in :http://www.upnp.org/specs/av/UPnP-av-RenderingControl-v1-Service.pdf
>
> In upnpx it will be something like this:
>
> int v = 50;
>
> [[device renderingControl] SetVolumeWithInstanceID:@"0" Channel:@"Master"
> DesiredVolume:[NSString stringWithFormat:@"%d", (int)v] ];
>
> Regards,
>
> Bruno
>
> On Tue, Oct 11, 2011 at 6:17 AM, sudheer dantuluri <
>

sudheer dantuluri

unread,
Oct 14, 2011, 4:50:46 AM10/14/11
to up...@googlegroups.com
Hi Bruno,

Is there any API support to handle DMPr from m-DMC? It would be great if you can provide me some help as how to proceed to achieve this functionality.

Thanks
Sudheer

sudheer dantuluri

unread,
Oct 27, 2011, 2:53:52 AM10/27/11
to upnpx
Hi Bruno,

Facing issues while refreshing the SSDP search. I'm getting a "Socket error!" log while trying to refresh the search. I've added a refresh button which actually does the following.

Please find the code snippet below. Is there anything that I'm missing to refresh the search?

- (void)refresh
{
    [[self.upnpManager SSDP] stopSSDP]; 
    [[self.upnpManager SSDP] startSSDP]; 
}


Thanks
Sudheer

Bruno

unread,
Oct 28, 2011, 11:22:02 AM10/28/11
to upnpx
Hi Sudheer,

The way to refresh is the following:

- (void)refresh
{
[[[UPnPManager GetInstance] SSDP] searchSSDP];
}

I have to take a look at the stop and start again, stop is not fully
implemented so far.

Bruno



On Oct 27, 2:53 am, sudheer dantuluri <dantuluri.sudh...@gmail.com>
wrote:
> Hi Bruno,
>
> Facing issues while refreshing the SSDP search. I'm getting a *"Socket
> error!"* log while trying to refresh the search. I've added a refresh button

Kasper

unread,
Nov 9, 2011, 1:25:54 AM11/9/11
to upnpx

Hi Bruno

I use the same way of your Demo on iPhone.

I add following:

SoapActionsAVTransport1* _avTransport = [m_device avTransport];

but _avTransport is nil.

I miss something ?

It would be great if you can find the problem.

Have a nice day.

Kasper

Kasper

unread,
Nov 10, 2011, 10:47:05 PM11/10/11
to upnpx
Hi All:

I use Demo.

And I found my device has three service.

1. urn:schemas-upnp-org:service:ConnectionManager:1
2. urn:schemas-upnp-org:service:ContentDirectory:1
3. urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1

I can use What service to play video or audio ?

Thanks a lot.

Bruno

unread,
Nov 11, 2011, 7:29:45 AM11/11/11
to upnpx
Hi Kasper,

This device is a "MediaServer" ?
If so you can use the ContentDirectory to query and access the Media:

[[m_device contentDirectory] BrowseWithObjectID:m_rootId
BrowseFlag:@"BrowseDirectChildren" Filter:@"*" StartingIndex:@"0"
RequestedCount:@"0" SortCriteria:@"+dc:title" OutResult:outResult
OutNumberReturned:outNumberReturned OutTotalMatches:outTotalMatches
OutUpdateID:outUpdateID];

See:
http://code.google.com/p/upnpx/source/browse/tags/Release-1.2.3/projects/xcode4/upnpxdemo/upnpxdemo/FolderViewController.m#72



Once you have the URL's to the media, you can render it local on the
iPhone/Mac or play it on a UPnP renderer;

To play on a remote UPnP "MediaRenderer", take the MediaRenderer
AVTransport and do something like this:

[[renderer avTransport] SetPlayModeWithInstanceID:@"0"
NewPlayMode:@"NORMAL"];
[[renderer avTransport] SetAVTransportURIWithInstanceID:@"0"
CurrentURI:[mediaItem uri] CurrentURIMetaData:@""];
[[renderer avTransport] PlayWithInstanceID:@"0" Speed:@"1"];


Bruno

Kasper

unread,
Nov 13, 2011, 8:57:41 PM11/13/11
to up...@googlegroups.com

Hi Bruno:

Yes. device is a  "MediaServer"
And I use the ContentDirectory to query and access the Media.

I get the uri Collection.
And I try each uri Path. it can't work.

I can use the same way to see photo.
but i can't use the uri path to render audio or  video.
So, I try you talk on the google group.
I can't find "MediaRender1Device".




"MediaRenderer"?
Do you mean "MediaRender1Device" ?

But the device can't transform to MediaRender1Device.


MediaRender1Device *renderDevice = (MediaRender1Device*)m_device;

PS. m_device is "MediaServer1Device" 

how to transform device?


Thanks a lot !!

mbalanti

unread,
May 3, 2012, 10:43:47 AM5/3/12
to up...@googlegroups.com
Hi,

I'm trying to send a PLAY command from iPhone to Samsung TV.

This is the code:


        NSLog(@"AvTransport is %@", [render avTransport]);

        [[render avTransport] SetPlayModeWithInstanceID:@"0" NewPlayMode:@"NORMAL"]; 

        [[render avTransport] SetAVTransportURIWithInstanceID:@"ABC" CurrentURI:@"http://www.w3schools.com/html5/movie.mp4" CurrentURIMetaData:@"" ]; 

        [[render avTransport] PlayWithInstanceID:@"ABC" Speed:@"1"]; 



However, all I get is this event:

{

    AVTransportURI = "";

    AVTransportURIMetaData = "";

    CurrentMediaDuration = "0:00:00";

    CurrentPlayMode = NORMAL;

    CurrentRecordQualityMode = "NOT_IMPLEMENTED";

    CurrentTrack = 0;

    CurrentTrackDuration = "0:00:00";

    CurrentTrackMetaData = "";

    CurrentTrackURI = "";

    CurrentTransportActions = "";

    InstanceID = "NOT_IMPLEMENTED";

    NextAVTransportURI = "NOT_IMPLEMENTED";

    NextAVTransportURIMetaData = "NOT_IMPLEMENTED";

    NumberOfTracks = 0;

    PlaybackStorageMedium = "NETWORK,NONE";

    PossiblePlaybackStorageMedia = "NETWORK,NONE";

    PossibleRecordQualityModes = "NOT_IMPLEMENTED";

    PossibleRecordStorageMedia = "NOT_IMPLEMENTED";

    RecordMediumWriteStatus = "NOT_IMPLEMENTED";

    RecordStorageMedium = "NOT_IMPLEMENTED";

    TransportPlaySpeed = 1;

    TransportState = "NO_MEDIA_PRESENT";

    TransportStatus = OK;

}


Can anybody guide me to what I am doing wrong? On samsung TV, nothing happens.

Regards,

Bruno Keymolen

unread,
May 3, 2012, 10:50:10 AM5/3/12
to up...@googlegroups.com
Although is say  InstanceID = "NOT_IMPLEMENTED"; can you try instance id @"0" (like you already did with SetPlayMode)?

mbalanti

unread,
May 3, 2012, 11:02:53 AM5/3/12
to up...@googlegroups.com
Hi, 

that was a fast response :) Thank you!

Actually the "0" instanceID is first thing i tried and it also didn't work.

It does however produce different event (however still nothing happens on TV):

}

2012-05-03 17:01:05.069 upnpxdemo[41697:12b03] New event: {

    AVTransportURI = "http://www.w3schools.com/html5/movie.mp4";

    CurrentMediaDuration = "0:00:00";

    CurrentPlayMode = NORMAL;

    CurrentRecordQualityMode = "NOT_IMPLEMENTED";

    CurrentTrackDuration = "0:00:00";

    InstanceID = "NOT_IMPLEMENTED";

    NextAVTransportURI = "NOT_IMPLEMENTED";

    NextAVTransportURIMetaData = "NOT_IMPLEMENTED";

    PlaybackStorageMedium = "NETWORK,NONE";

    PossiblePlaybackStorageMedia = "NETWORK,NONE";

    PossibleRecordQualityModes = "NOT_IMPLEMENTED";

    PossibleRecordStorageMedia = "NOT_IMPLEMENTED";

    RecordMediumWriteStatus = "NOT_IMPLEMENTED";

    RecordStorageMedium = "NOT_IMPLEMENTED";

    TransportPlaySpeed = 1;

    TransportState = "NO_MEDIA_PRESENT";

    TransportStatus = OK;

}


On Thursday, May 3, 2012 4:50:10 PM UTC+2, Bruno wrote:
Although is say  InstanceID = "NOT_IMPLEMENTED"; can you try instance id @"0" (like you already did with SetPlayMode)?

mbalanti

unread,
May 3, 2012, 11:12:16 AM5/3/12
to up...@googlegroups.com
Hi,

adding metadata XML made all the difference:

        [[render avTransport] SetAVTransportURIWithInstanceID:@"0" CurrentURI:@"http://www.w3schools.com/html5/movie.mp4" CurrentURIMetaData:@"&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot;&gt;&lt;item&gt;&lt;dc:title&gt;Test&lt;/dc:title&gt;&lt;upnp:class&gt;object.item.videoItem&lt;/upnp:class&gt;&lt;res  protocolInfo=&quot;file-get:*:video/mp4::DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=00000000001000000000000000000000&quot;&gt;http://www.w3schools.com/html5/movie.mp4&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;" ]; 


Now the TV at least cries that this video's format is unsupported. That's a progress :)

It looks like samsung requires metadata present.

Regards

RastArt

unread,
Nov 1, 2012, 3:29:46 PM11/1/12
to up...@googlegroups.com
Hi mbalanti,

I'm stuck in my project with the same problem as you: create proper metadata XML for target TV. Can you please give an advice? Did you find a solution?

Thank you in advance

$vkbist

unread,
Mar 26, 2015, 8:52:46 AM3/26/15
to up...@googlegroups.com
Hi Bruno, 

I am developing an application using the upnpx library for iOS. But i am not getting how to play audio/video file in our iPhone device. I know i'll use "SoapActionsAVTransport1" file and one render terms is here. but i cann't able to set up all those thing in proper order. please help me how will to play audio/video . 
Reply all
Reply to author
Forward
0 new messages