Author Topic: DLNA Media Controller plugin - Common library for UPnP AV  (Read 195338 times)

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 859
  • Karma: +63/-8
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #165 on: November 10, 2013, 07:13:01 pm »
This looks very promising - great effort.

Discovery of servers and renders works OK. I can browse through files on a Twonky media server and play them to my Sonos boxes. Mute works and TTS works. The Sonos boxes also come up as servers - I assume that's their aux line inputs?

I also have a Yamaha AV receiver but I can't see any interaction with the AV RX or control it. It may be operator error on my part. So if I directly set up the Yamaha AV receiver (using its IR remote control) to play music from the Twonky media server, that works. But I would have thought at that point the plugin would show that happening - that is display what's being played and also be able to control it?

Have attached the desc file and here is the discovery:

Code: [Select]
50 11/11/13 8:36:00.751 luup_log:0: UPnP device discovered HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1800
EXT:
LOCATION: http://172.22.22.24:8080/MediaRenderer/desc.xml
SERVER: KnOS/3.2 UPnP/1.0 DMP/3.5
ST: urn:schemas-upnp-org:device:MediaRenderer:1
USN: uuid:5f9ec1b3-ed59-1900-4530-00a0de911f72::urn:schemas-upnp-org:device:MediaRenderer:1

I see this error message when I try and play something on the Yamaha:

Code: [Select]
LuaInterface::CallFunction_Job device 88 function SDLNAMediaController1_DLNAMediaController1_SelectDMRDevice_run failed [string "..."]:739: attempt to index field 'UDN' (a nil value)
Minor request - it would be good if the pull down lists showed what was previously selected. They keep defaulting to the first on the list. The selected="selected" attribute can track this in the list option tags using:

Code: [Select]
pullDownList.options[i].selected = true;

Offline Da_JoJo

  • Hero Member
  • *****
  • Posts: 1380
  • Karma: +16/-78
  • If something aint work, we can allways try n make
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #166 on: November 10, 2013, 09:25:33 pm »
tested on vera 3 lite:
added files (without the sonos as i dont have this) and made device with : D_DLNAMediaController1.xml and I_DLNAMediaController1.xml  rebooted vera.
autodiscovery detects in settings: Samsung TV UE46ES8000 (http://192.168.1.20:7676/smp_16_)
                                    in player : asus router (windows media connect compatible) , PLEX mediaserver, Windows Media Player sharing, PC (samsung link)

tested:
           PLAY > select from PLEX library > Bolt 3D movie > play  .. test ok, plays movie on samsung tv
           TTS : on samsung tv> not supported format or something like that as it went to fast to be able to read.. continued playing Bolt 3D movie after this
           URI: put http://broadcast.infomaniak.net/ouifm-high.mp3  in the box and pressed play.. plays Bolt 3D movie again..

conclusion:
 not needed for vera lite to change IPTables (i have autodetect UPnP devices in net-tab turned off, donno if this matter) , just put in the Implementation file in the device and reboot vera.
 thing is working OK for movies (MKV 4 high bitrate type).
 pressing volume slider on control-tab > invalid service
 seems that URI not working as it parses chosen movie again.
« Last Edit: November 10, 2013, 09:37:49 pm by Da_JoJo »
Vera lite (1.5.622), 2x an-158/2, dead usb pl2302 rs-232, 2x greenwave 6 port, 4x Fibaro FGD211 v1.6, FGBS001, few FGS - 221, etc. AuthomationHD 3 for android :-)
Dutch & German translator http://wiki.micasaverde.com/index.php/Special:AllPages http://support.micasaverde.com http://domotica-shop.nl

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #167 on: November 11, 2013, 04:18:14 am »
tested on vera 3 lite:
added files (without the sonos as i dont have this) and made device with : D_DLNAMediaController1.xml and I_DLNAMediaController1.xml  rebooted vera.

...

 just put in the Implementation file in the device and reboot vera.

...

 pressing volume slider on control-tab > invalid service
 seems that URI not working as it parses chosen movie again.

The two service files are not for Sonos but are THE services files implemented by the plugin devices. They are required.
I have not yet changed their names because I am not sure that it can not lead to a problem for users using the Sonos plugin too.

Of course, you could create your own AVTransport and RenderingControl service files, but you can have only one instance of these services in the Vera: http://forum.micasaverde.com/index.php/topic,17280.0.html
And furthermore, the files have to be named S_SonosAVTransport1.xml and S_SonosRenderingControl1.xml because it is what is defined in the file D_DLNAMediaController1.xml.

As a conclusion, I will not study your other problems as it could be simply the consequence of the uncomplete installation of the plugin.

But if you provide your AVTransport and RenderingControl service files from your DMR, I will check if they have additional things compared to my current files, and then add them to my files.
« Last Edit: November 11, 2013, 04:25:00 am by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #168 on: November 11, 2013, 04:21:49 am »
autodiscovery detects in settings: Samsung TV UE46ES8000 (http://192.168.1.20:7676/smp_16_)
                                    in player : asus router (windows media connect compatible) , PLEX mediaserver, Windows Media Player sharing, PC (samsung link)
...

 not needed for vera lite to change IPTables (i have autodetect UPnP devices in net-tab turned off, donno if this matter)

Interesting.

macfly and me: not working
futzle, a-lurker and you: working

Why ? That's the question...
« Last Edit: November 11, 2013, 04:25:55 am by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #169 on: November 11, 2013, 04:30:54 am »
This looks very promising - great effort.

Discovery of servers and renders works OK. I can browse through files on a Twonky media server and play them to my Sonos boxes. Mute works and TTS works. The Sonos boxes also come up as servers - I assume that's their aux line inputs?

No.
Sonos is a DMR + a DMS. But the Sonos DMS can only be connected to a Sonos DMR. They use vendor specific protocol names.
So you can browse the server ... but that's all.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #170 on: November 11, 2013, 04:36:10 am »
I also have a Yamaha AV receiver but I can't see any interaction with the AV RX or control it. It may be operator error on my part. So if I directly set up the Yamaha AV receiver (using its IR remote control) to play music from the Twonky media server, that works. But I would have thought at that point the plugin would show that happening - that is display what's being played and also be able to control it?

Have attached the desc file and here is the discovery:

Code: [Select]
50 11/11/13 8:36:00.751 luup_log:0: UPnP device discovered HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1800
EXT:
LOCATION: http://172.22.22.24:8080/MediaRenderer/desc.xml
SERVER: KnOS/3.2 UPnP/1.0 DMP/3.5
ST: urn:schemas-upnp-org:device:MediaRenderer:1
USN: uuid:5f9ec1b3-ed59-1900-4530-00a0de911f72::urn:schemas-upnp-org:device:MediaRenderer:1

I see this error message when I try and play something on the Yamaha:

Code: [Select]
LuaInterface::CallFunction_Job device 88 function SDLNAMediaController1_DLNAMediaController1_SelectDMRDevice_run failed [string "..."]:739: attempt to index field 'UDN' (a nil value)

Very interesting. I didn't know that AV receivers were DLNA receivers.
The error is due to a parsing error of your file by my code. I will fix that as soon as possible. And I will add a control in case the parsing is not able to retrieve the UDN field.

It could be interesting to provide your AVTransport and RenderingControl files. I could add special actions provided by Yamaha.

Offline Da_JoJo

  • Hero Member
  • *****
  • Posts: 1380
  • Karma: +16/-78
  • If something aint work, we can allways try n make
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #171 on: November 11, 2013, 06:00:23 am »
autodiscovery detects in settings: Samsung TV UE46ES8000 (http://192.168.1.20:7676/smp_16_)
                                    in player : asus router (windows media connect compatible) , PLEX mediaserver, Windows Media Player sharing, PC (samsung link)
...

 not needed for vera lite to change IPTables (i have autodetect UPnP devices in net-tab turned off, donno if this matter)

Interesting.

macfly and me: not working
futzle, a-lurker and you: working

Why ? That's the question...
perhaps different sub-net ? the DLNA thing uses broadcast on 255.255.255.255 subnet from what i understand. or the difference lies in that we have a vera lite ?
edit:
support for Yamaha would be really great  ;D   > port of yammie avcontroller https://yavc.svn.codeplex.com/svn/
also a lot of new av-receivers have DLNA onboard nowadays. onkyo has one too. sony and pioneer also. most of them support only audio though
 i wonder what would be possible with the vera and the samsung tv as it gives me 3 devices:
urn:schemas-upnp-org:device:MediaRenderer:1      devicefile: D_FUP_uuid 10b07600-0018-1000-a8eb-4844f7bcb3f7.xml <mediarenderer
urn:samsung.com:device:RemoteControlReceiver:1  devicefile: D_FUP_uuid 0f7f4900-0004-1000-8793-4844f7bcb3f7.xml  <remote control for tv
urn:samsung.com:device:MainTVServer2:1               devicefile: D_FUP_uuid 0bebc200-00c8-1000-93b0-4844f7bcb3f7.xml  <second screen for digital tv output
in UI5>devices>AV-gear it doesn't show my tv
« Last Edit: November 11, 2013, 06:28:27 am by Da_JoJo »
Vera lite (1.5.622), 2x an-158/2, dead usb pl2302 rs-232, 2x greenwave 6 port, 4x Fibaro FGD211 v1.6, FGBS001, few FGS - 221, etc. AuthomationHD 3 for android :-)
Dutch & German translator http://wiki.micasaverde.com/index.php/Special:AllPages http://support.micasaverde.com http://domotica-shop.nl

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #172 on: November 11, 2013, 06:39:49 am »
perhaps different sub-net ? the DLNA thing uses broadcast on 255.255.255.255 subnet from what i understand. or the difference lies in that we have a vera lite ?

We all have a VeraLite (don't know for a-lurker).
Our VeraLite is on the same subnet as the DMRs.
« Last Edit: November 11, 2013, 06:57:47 am by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #173 on: November 11, 2013, 06:56:47 am »
support for Yamaha would be really great  ;D   > port of yammie avcontroller https://yavc.svn.codeplex.com/svn/
also a lot of new av-receivers have DLNA onboard nowadays. onkyo has one too. sony and pioneer also. most of them support only audio though
 i wonder what would be possible with the vera and the samsung tv as it gives me 3 devices:
urn:schemas-upnp-org:device:MediaRenderer:1      devicefile: D_FUP_uuid 10b07600-0018-1000-a8eb-4844f7bcb3f7.xml <mediarenderer
urn:samsung.com:device:RemoteControlReceiver:1  devicefile: D_FUP_uuid 0f7f4900-0004-1000-8793-4844f7bcb3f7.xml  <remote control for tv
urn:samsung.com:device:MainTVServer2:1               devicefile: D_FUP_uuid 0bebc200-00c8-1000-93b0-4844f7bcb3f7.xml  <second screen for digital tv output
in UI5>devices>AV-gear it doesn't show my tv

The first purpose of my plugin is to be a DLNA Control Point. So I will "work" with devices of type "urn:schemas-upnp-org:device:MediaRenderer:1" and "urn:schemas-upnp-org:device:MediaServer:1", not others.

Your other Samsung device types are certainly specific UPnP devices created by Samsung to control the Samsung through UPnP. For this, you need to develop a specific plugin.
BUT my lua library could certainly be of a great help for this development. It was the second purpose of my plugin: create a common library that provides a high-level access to UPnP (including @futzle's UPnP event proxy). This library is not yet fully commented. That's is in my TODO list. This library can help anybody to create a new plugin based on UPnP even without knowing SOAP messages used by UPnP or even without knowing the HTTP interface to be used with the UPnP event proxy.
« Last Edit: November 11, 2013, 07:04:27 am by lolodomo »

Offline macfly92

  • Full Member
  • ***
  • Posts: 132
  • Karma: +1/-0
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #174 on: November 11, 2013, 08:30:17 am »
Here is the Logs when I changed Volume Level On my Linux Renderer, didn't found some errors.
When I control It with Bubble Upnp, Feedback are Ok, I see Volume Level status change even if I control It from Vera (just to check if is a gmediarender problem but seem not).

Code: [Select]
08      11/11/13 14:21:44.866   JobHandler_LuaUPnP::HandleActionRequest argument sid=uuid:1360c372-1dd2-11b2-9336-c95f22385e65 <0x2d5a3680>
04      11/11/13 14:21:44.869   <Job ID="567" Name="" Device="41" Created="2013-11-11 14:21:44" Started="2013-11-11 14:21:44" Completed="2013-11-11 14:21:44" Duration="0.2436000" Runtime="0.1462000" Status="Successful" LastNote=""/> <0x2b470000>
08      11/11/13 14:21:45.399   JobHandler_LuaUPnP::HandleActionRequest device: 41 service: urn:upnp-org:serviceId:RenderingControl action: SetVolume <0x2e5a3680>
08      11/11/13 14:21:45.399   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=41 <0x2e5a3680>
08      11/11/13 14:21:45.399   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:RenderingControl <0x2e5a3680>
08      11/11/13 14:21:45.399   JobHandler_LuaUPnP::HandleActionRequest argument action=SetVolume <0x2e5a3680>
08      11/11/13 14:21:45.400   JobHandler_LuaUPnP::HandleActionRequest argument DesiredVolume=80 <0x2e5a3680>
08      11/11/13 14:21:45.400   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.7999017278198153 <0x2e5a3680>
08      11/11/13 14:21:45.465   JobHandler_LuaUPnP::HandleActionRequest device: 41 service: urn:dlna-org:serviceId:DLNAMediaController1 action: NotifyRenderingChange <0x2e5a3680>
08      11/11/13 14:21:45.465   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=41 <0x2e5a3680>
08      11/11/13 14:21:45.466   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:dlna-org:serviceId:DLNAMediaController1 <0x2e5a3680>
08      11/11/13 14:21:45.466   JobHandler_LuaUPnP::HandleActionRequest argument action=NotifyRenderingChange <0x2e5a3680>
08      11/11/13 14:21:45.466   JobHandler_LuaUPnP::HandleActionRequest argument LastChange=<?xml version="1.0"?>
<Event xmlns="urn:schemas-upnp-org:metadata-1-0/AVT/">
<InstanceID val="0">
<Volume val="80"></Volume>
<VolumeDB val="-2048"></VolumeDB>
</InstanceID>
</Event>
 <0x2e5a3680>
08      11/11/13 14:21:45.466   JobHandler_LuaUPnP::HandleActionRequest argument sid=uuid:1360c372-1dd2-11b2-9336-c95f22385e65 <0x2e5a3680>
04      11/11/13 14:21:45.469   <Job ID="568" Name="" Device="41" Created="2013-11-11 14:21:45" Started="2013-11-11 14:21:45" Completed="2013-11-11 14:21:45" Duration="0.2175000" Runtime="0.1242000" Status="Successful" LastNote=""/> <0x2b470000>

As soon as I have some free time, I will change The xml file like you said and post results.


Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #175 on: November 11, 2013, 08:45:52 am »
They forgot the channel (master).
I should probably assume a default value of Master.
I will provide a fix.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #176 on: November 11, 2013, 09:04:07 am »
Can you show the received event for a pause command ?

Offline macfly92

  • Full Member
  • ***
  • Posts: 132
  • Karma: +1/-0
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #177 on: November 11, 2013, 11:54:47 am »
This is log for a pause command :

Code: [Select]
Device_Variable::m_szValue_set device: 41 service: urn:upnp-org:serviceId:AVTransport variable: RelativeTimePosition was: 0:00:21 now: 0:00:25 #hooks: 0 upnp: 0 v:0x917888/NONE duplicate:0 <0x2b470000>
06      11/11/13 17:52:26.259   Device_Variable::m_szValue_set device: 41 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1384188740 now: 1384188746 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2b470000>
04      11/11/13 17:52:26.260   <Job ID="1066" Name="" Device="41" Created="2013-11-11 17:52:23" Started="2013-11-11 17:52:23" Completed="2013-11-11 17:52:26" Duration="3.140311000" Runtime="3.138257000" Status="Successful" LastNote=""/> <0x2b470000>
08      11/11/13 17:52:35.181   JobHandler_LuaUPnP::HandleActionRequest device: 41 service: urn:micasaverde-com:serviceId:MediaNavigation1 action: Pause <0x2e5a3680>
08      11/11/13 17:52:35.181   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=41 <0x2e5a3680>
08      11/11/13 17:52:35.182   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:MediaNavigation1 <0x2e5a3680>
08      11/11/13 17:52:35.182   JobHandler_LuaUPnP::HandleActionRequest argument action=Pause <0x2e5a3680>
08      11/11/13 17:52:35.182   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.11442834767512977 <0x2e5a3680>
08      11/11/13 17:52:35.281   JobHandler_LuaUPnP::HandleActionRequest device: 41 service: urn:dlna-org:serviceId:DLNAMediaController1 action: NotifyAVTransportChange <0x2e5a3680>
08      11/11/13 17:52:35.282   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=41 <0x2e5a3680>
08      11/11/13 17:52:35.282   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:dlna-org:serviceId:DLNAMediaController1 <0x2e5a3680>
08      11/11/13 17:52:35.282   JobHandler_LuaUPnP::HandleActionRequest argument action=NotifyAVTransportChange <0x2e5a3680>
08      11/11/13 17:52:35.283   JobHandler_LuaUPnP::HandleActionRequest argument LastChange=<?xml version="1.0"?>
<Event xmlns="urn:schemas-upnp-org:metadata-1-0/AVT/">
<InstanceID val="0">
<TransportState val="PAUSED_PLAYBACK"></TransportState>
<CurrentTransportActions val="PLAY,STOP,SEEK"></CurrentTransportActions>
</InstanceID>
</Event>
 <0x2e5a3680>
08      11/11/13 17:52:35.283   JobHandler_LuaUPnP::HandleActionRequest argument sid=uuid:70a5b95a-1dd2-11b2-94dd-91666962d395 <0x2e5a3680>
06      11/11/13 17:52:35.404   Device_Variable::m_szValue_set device: 41 service: urn:upnp-org:serviceId:AVTransport variable: RelativeTimePosition was: 0:00:25 now: 0:00:34 #hooks: 0 upnp: 0 v:0x917888/NONE duplicate:0 <0x2b470000>
06      11/11/13 17:52:35.429   Device_Variable::m_szValue_set device: 41 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1384188746 now: 1384188755 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2b470000>

No update from Vera UI in pause play stop command too.

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 859
  • Karma: +63/-8
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #178 on: November 11, 2013, 03:31:50 pm »
On the Yamaha AV receiver - I have attached the files:

/RenderingControl/desc.xml
/ConnectionManager/desc.xml
/AVTransport/desc.xml

I have a Vera 3. Its LAN switch and its WiFi are not used. I have a separate managed switch.

Out of interest the FritzBox modem/voip boxes also have a DLNA server in them.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: DLNA Media Controller plugin - Common library for UPnP AV
« Reply #179 on: November 11, 2013, 04:12:38 pm »
A project has been created in code.mios.com. My sources and my versions will now be available here: http://code.mios.com/trac/mios_dlna-cntroller/browser#
I will create a wiki page ... when I have time.