streamaserver / streama

Self hosted streaming media server. https://docs.streama-project.com/
MIT License
9.67k stars 985 forks source link

DNLA Support #58

Open stramel opened 9 years ago

stramel commented 9 years ago

I didn't see anywhere that DNLA was supported so if it isn't it definitely should be implemented.

admwx7 commented 9 years ago

:+1:

dularion commented 9 years ago

Does anyone have any experience with that?

gkiko commented 9 years ago

Have you considered using nodecast-js? Popcorn Time Desktop app uses this library. example

dularion commented 9 years ago

I have not heard of it. But from it being js and the fact that its called "node"cast-js , can i presume that is is code specifically for a nodejs application? Currently this application is not written with nodejs, but it is in the works here https://github.com/dularion/streama/issues/20

gkiko commented 9 years ago

Yes it's nodejs library which apparently won't work for you.

Quick googling brought me to Cling which is Java library. I think Java source can be integrated under Grails. stack

gkiko commented 9 years ago

@dularion since you are working on nodejs port is java DLNA library still needed?

dularion commented 9 years ago

It sort of depends how the port goes. I am currently very optimistic, but 1) it might take some time, because I am getting to know the framework as i go, and 2) it might not work out in the same way as this app did. So in order to get it up and running soon-ish, the java library is not off the table imho.

gkiko commented 9 years ago

Working on this feature. Will post results

gkiko commented 9 years ago

protocol fetures

Best explanation of UPnP basic idea: http://stackoverflow.com/a/1705041/660408

Cling appears to be very generic and strict implementation of UPnP specification. It allows to describe UPnP services, make network requests and deserialise SOAP responses to java objects. While nodecast-js seems to be hiding a lot of protocol related code making it easier to use.

Popcorn-Time and Wireshark revealed that media content is pulled from DMS(digital media server; we need to implement this) by DMR(digital media renderer; e.g. TV, PS3) which is controlled by DMC(digital media controller; we need to implement this).

1 . Popcorn-Time(192.168.1.101; DMC+DMS) tells the TV(192.168.1.132) to pull video content from DMS

POST /upnp/control/AVTransport HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: 987
Connection: close
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
Host: 192.168.1.132:52323

<?xml version='1.0' encoding='utf-8'?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><CurrentURI>http://192.168.1.101:54723/</CurrentURI><CurrentURIMetaData>&lt;DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:sec="http://www.sec.co.kr/" xmlns:xbmc="urn:schemas-xbmc-org:metadata-1-0/"&gt;&lt;item id="0" parentID="-1" restricted="1"&gt;&lt;dc:title&gt;Popcorn Time Video&lt;/dc:title&gt;&lt;res protocolInfo="http-get:*:video/mp4:*"&gt;http://192.168.1.101:54723/&lt;/res&gt;&lt;upnp:class&gt;object.item.videoItem.movie&lt;/upnp:class&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData></u:SetAVTransportURI></s:Body></s:Envelope>

You can see that DMC sent http://192.168.1.101:54723/. GET request to this url starts video stream.

2 . TV sends GET request to the provided url and starts showing content on the screen

GET / HTTP/1.1
Range: bytes=0-
getcontentFeatures.dlna.org: 1
Pragma: getIfoFileURI.dlna.org
X-AV-Physical-Unit-Info: pa="BRAVIA KDL-32W705B";
X-AV-Client-Info: av=5.0; cn="Sony Corporation"; mn="BRAVIA KDL-32W705B"; mv="1.7";
Host: 192.168.1.101:54723

HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Content-Type: video/mp4
transferMode.dlna.org: Streaming
contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000
CaptionInfo.sec: http://192.168.1.101:9999/video.srt
Content-Length: 909815746
Content-Range: bytes 0-909815745/909815746
Date: Sun, 30 Aug 2015 14:37:10 GMT
Connection: keep-alive

....ftypisom....isomavc1.8.Nmoov...lmvhd...............X.B".................................................@...................................iods.......O..)... p.trak..

plan ?

I believe that streama already provides easy access to video stream. I think that we need to implement only media controller. It may be possible to get along without the media server unless we provide media streaming.

I would be happy if someone more experienced than me could indicate some materials to read about UPnP/DLNA :monkey:

admwx7 commented 9 years ago

The best I can offer is that after a Google search you can find the official DLNA spec, though you have to register as a member to gain access to the document.

On Sun, Aug 30, 2015, 12:27 PM Giorgi Kikolashvili notifications@github.com wrote:

protocol fetures

Best explanation of UPnP basic idea: http://stackoverflow.com/a/1705041/660408

Cling http://4thline.org/projects/cling/core/ appears to be very generic and strict implementation of UPnP specification. It allows to describe UPnP services, make network requests and deserialise SOAP responses to java objects. While nodecast-js seems to be hiding a lot of protocol related code making it easier to use.

Popcorn-Time https://popcorntime.io and Wireshark revealed that media content is pulled from DMS(digital media server; we need to implement this) by DMR(digital media renderer; e.g. TV, PS3) which is controlled by DMC(digital media controller; we need to implement this).

1 . Popcorn-Time(192.168.1.101; DMC+DMS) tells the TV(192.168.1.132) to pull video content from DMS

POST /upnp/control/AVTransport HTTP/1.1 Content-Type: text/xml; charset="utf-8" Content-Length: 987 Connection: close SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI" Host: 192.168.1.132:52323

<?xml version='1.0' encoding='utf-8'?> 0http://192.168.1.101:54723/<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:sec="http://www.sec.co.kr/" xmlns:xbmc="urn:schemas-xbmc-org:metadata-1-0/"><item id="0" parentID="-1" restricted="1"><dc:title>Popcorn Time Video</dc:title><res protocolInfo="http-get::video/mp4:">http://192.168.1.101:54723/&lt;/res&gt;&lt;upnp:class&gt;object.item.videoItem.movie&lt;/upnp:class&gt;&lt;/item&gt;& lt;/DIDL -Lite>/u:SetAVTransportURI/s:Body/s:Envelope

You can see that DMC sent http://192.168.1.101:54723/. GET request to this url starts video stream.

2 . TV sends GET request to the provided url and starts showing content on the screen

GET / HTTP/1.1 Range: bytes=0-getcontentFeatures.dlna.org: 1 Pragma: getIfoFileURI.dlna.org X-AV-Physical-Unit-Info: pa="BRAVIA KDL-32W705B"; X-AV-Client-Info: av=5.0; cn="Sony Corporation"; mn="BRAVIA KDL-32W705B"; mv="1.7"; Host: 192.168.1.101:54723

HTTP/1.1 206 Partial Content Accept-Ranges: bytes Content-Type: video/mp4transferMode.dlna.org: StreamingcontentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000 CaptionInfo.sec: http://192.168.1.101:9999/video.srt Content-Length http://192.168.1.101:9999/video.srtContent-Length: 909815746 Content-Range: bytes 0-909815745/909815746 Date: Sun, 30 Aug 2015 14:37:10 GMT Connection: keep-alive

....ftypisom....isomavc1.8.Nmoov...lmvhd...............X.B".................................................@...................................iods.......O..)... p.trak..

plan ?

I believe that streama already provides easy access to video stream. I think that we need to implement only media controller. It may be possible to get along without the media server unless we provide media streaming.

I would be happy if someone more experienced than me could indicate some materials to read about UPnP/DLNA [image: :monkey:]

— Reply to this email directly or view it on GitHub https://github.com/dularion/streama/issues/58#issuecomment-136161801.