Indirect http streaming

DVBLink Remote API clients and tools

Indirect http streaming

Postby tommer » Mon Apr 09, 2012 6:05 pm

I?m trying to get indirect HTTP streaming to work, but I?m struggling.

Using Delphi...

Reading channels (get_channels) goes fine.

When I'm trying to play a specific channel I?m using the following Delphi code:
Code: Select all
  responseXML := TXMLDocument.Create(nil) ;
  request := TStringList.Create;
  responseXML.Active := true;
  data := TIdMultiPartFormDataStream.Create;

  dataStr := '<?xml version="1.0" encoding="utf-8" ?>'
    + '<stream xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dvblogic.com">'
    + '<channel_dvblink_id>' + chl + '</channel_dvblink_id>'
    + '<client_id>AAAAAAAAA</client_id>'
    +'<server_address>'+ '10.0.0.120' +'</server_address>'
    +'<stream_type>' + 'raw_http' + '</stream_type>'
    +'<transcoder>'
    +'<bitrate>'+ '512' +'</bitrate>'
    +'<height>'+ '1024' +'</height>'
    +'<width>'+ '768' +'</width>'
    +'</transcoder>'
    +'</stream>';

  request.Append(dataStr);
  request.SaveToFile(extractfilepath(application.exename) + 'playRequest.xml');

  url:='http://10.0.0.120:8080/cs/';

  data.AddFormField('command','play_channel');
  data.AddFormField('xml_param',dataStr);

  (responseXML as IXMLDocumentAccess).DOMPersist.loadxml(idHttp.Post(url,data));
  responseXML.SaveToFile(extractfilepath(application.exename) + 'playResponse.xml');


  data.Free;
  request.Free;
  responseXML := nil;


This posts the following code to the server:
<?xml version="1.0" encoding="UTF-8"?>
<stream xmlns="http://www.dvblogic.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <channel_dvblink_id>10050000</channel_dvblink_id>
<client_id>AAAAAAAAA</client_id>
<server_address>10.0.0.120</server_address>
<stream_type>raw_http</stream_type>
<transcoder>
<bitrate>512</bitrate>
<height>1024</height>
<width>768</width>
</transcoder>
</stream>


Response from server:
<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://www.dvblogic.com"><status_code>1002</status_code><xml_result/></response>


Anybody knows what is wrong?
tommer
 
Posts: 18
Joined: Sun Feb 06, 2011 11:18 pm


Re: Indirect http streaming

Postby vendor » Mon Apr 09, 2012 6:16 pm

you can use "raw_http" for raw streams, but not for transcoded streaming:
the API says: "<transcoder> is optional element, defining the parameters of transcoded stream. It is used for certain stream types, namely rtp, hls and asf."
Server: W7 with DD Cine S2 V6 + DD Octopus NET S2/4 @ dvblink v5
Clients: 2x Notebook W7, PC W7, DLNA TV, iphone, 2x xbox360, Linksys DMA2200(zas2)
Admin of http://www.zas2.de
vendor
 
Posts: 15
Joined: Sat Jan 30, 2010 11:53 pm

Re: Indirect http streaming

Postby tommer » Mon Apr 09, 2012 10:11 pm

vendor wrote:you can use "raw_http" for raw streams, but not for transcoded streaming:
the API says: "<transcoder> is optional element, defining the parameters of transcoded stream. It is used for certain stream types, namely rtp, hls and asf."


Ok, so I remove the transcoding and send the following:

<?xml version="1.0" encoding="UTF-8"?>
<stream xmlns="http://www.dvblogic.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><channel_dvblink_id>10050000</channel_dvblink_id>
<client_id>AAAAAAAAA</client_id>
<server_address>10.0.0.120</server_address>
<stream_type>raw_http</stream_type></stream>


I post this using address http://10.0.0.120:8080/cs/ but still no luck. Response:
<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://www.dvblogic.com">
<status_code>1002</status_code>
<xml_result/>
</response>
tommer
 
Posts: 18
Joined: Sun Feb 06, 2011 11:18 pm

Re: Indirect http streaming

Postby Realman » Tue Apr 10, 2012 8:59 am

1. What version DVBLink Connect Server, DVBLink Source is used?
2. There can be trial version dvblink ended?
Set log level to Info and attach log file.
Realman
 
Posts: 805
Joined: Fri Mar 07, 2008 7:57 am

Re: Indirect http streaming

Postby Wal » Tue Apr 10, 2012 1:03 pm

tommer wrote:I?m trying to get indirect HTTP streaming to work, but I?m struggling.

Using Delphi...

Reading channels (get_channels) goes fine.

When I'm trying to play a specific channel I?m using the following Delphi code:
Code: Select all
  responseXML := TXMLDocument.Create(nil) ;
  request := TStringList.Create;
  responseXML.Active := true;
  data := TIdMultiPartFormDataStream.Create;

  dataStr := '<?xml version="1.0" encoding="utf-8" ?>'
    + '<stream xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dvblogic.com">'
    + '<channel_dvblink_id>' + chl + '</channel_dvblink_id>'
    + '<client_id>AAAAAAAAA</client_id>'
    +'<server_address>'+ '10.0.0.120' +'</server_address>'
    +'<stream_type>' + 'raw_http' + '</stream_type>'
    +'<transcoder>'
    +'<bitrate>'+ '512' +'</bitrate>'
    +'<height>'+ '1024' +'</height>'
    +'<width>'+ '768' +'</width>'
    +'</transcoder>'
    +'</stream>';

  request.Append(dataStr);
  request.SaveToFile(extractfilepath(application.exename) + 'playRequest.xml');

  url:='http://10.0.0.120:8080/cs/';

  data.AddFormField('command','play_channel');
  data.AddFormField('xml_param',dataStr);

  (responseXML as IXMLDocumentAccess).DOMPersist.loadxml(idHttp.Post(url,data));
  responseXML.SaveToFile(extractfilepath(application.exename) + 'playResponse.xml');


  data.Free;
  request.Free;
  responseXML := nil;



Code: Select all
responseXML := TXMLDocument.Create(nil) ;
  request := TStringList.Create;
  responseXML.Active := true;

  dataStr :=
    'command=play_channel&xml_param=<?xml version="1.0" encoding="utf-8" ?>'
    + '<stream xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dvblogic.com">'
    + '<channel_dvblink_id>' + chl + '</channel_dvblink_id>'
    + '<client_id>AAAAAAAAA</client_id>'
    +'<server_address>'+ '10.0.0.120' +'</server_address>'
    +'<stream_type>' + 'raw_http' + '</stream_type>'
    +'<transcoder>'
    +'<bitrate>'+ '512' +'</bitrate>'
    +'<height>'+ '1024' +'</height>'
    +'<width>'+ '768' +'</width>'
    +'</transcoder>'
    +'</stream>';

  request.Append(dataStr);
  request.SaveToFile(extractfilepath(application.exename) + 'playRequest.xml');

  url:='http://10.0.0.120:8080/cs/';

  (responseXML as IXMLDocumentAccess).DOMPersist.loadxml(idHttp.Post(url,dataStr));
  responseXML.SaveToFile(extractfilepath(application.exename) + 'playResponse.xml');

  request.Free;
  responseXML := nil;
Kaum macht's man richtig, funktioniert es auch. o(°:°)o

Server: ASRock AMD 3GHz 6-Core Win7 U 64, DVBLink 4.5 Server, Source, ConnectServer
Clients: ASRock AMD 3GHz 6-Core , ASUS AT5IONT-I Win7 U 64, NEC Beamer, IPhone4 32MB, ACER Iconia Tab A200
Wal
 
Posts: 60
Joined: Fri Nov 11, 2011 7:46 pm

Re: Indirect http streaming

Postby tommer » Tue Apr 10, 2012 9:55 pm

Wal wrote:
Code: Select all
responseXML := TXMLDocument.Create(nil) ;
  request := TStringList.Create;
  responseXML.Active := true;

  dataStr :=
    'command=play_channel&xml_param=<?xml version="1.0" encoding="utf-8" ?>'
    + '<stream xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dvblogic.com">'
    + '<channel_dvblink_id>' + chl + '</channel_dvblink_id>'
    + '<client_id>AAAAAAAAA</client_id>'
    +'<server_address>'+ '10.0.0.120' +'</server_address>'
    +'<stream_type>' + 'raw_http' + '</stream_type>'
    +'<transcoder>'
    +'<bitrate>'+ '512' +'</bitrate>'
    +'<height>'+ '1024' +'</height>'
    +'<width>'+ '768' +'</width>'
    +'</transcoder>'
    +'</stream>';

  request.Append(dataStr);
  request.SaveToFile(extractfilepath(application.exename) + 'playRequest.xml');

  url:='http://10.0.0.120:8080/cs/';

  (responseXML as IXMLDocumentAccess).DOMPersist.loadxml(idHttp.Post(url,dataStr));
  responseXML.SaveToFile(extractfilepath(application.exename) + 'playResponse.xml');

  request.Free;
  responseXML := nil;


The line:

(responseXML as IXMLDocumentAccess).DOMPersist.loadxml(idHttp.Post(url,dataStr));

gives an exception:
First chance exception at $7594D36F. Exception class EFOpenError with message 'Cannot open file "C:\Users\Wide\Documents\RAD Studio\Projects\tvPlayer\Win32\Debug\command=play_channel&xml_param=<?xml version="1.0" encoding="utf-8" ?><stream xmlns:i="http:\www.w3.org\2001\XMLSchema-instance" xmlns="http:\www.dvblogic.com"><channel_dvblink_id>10050000<\channel_dvblink_id><client_id>AAAAAAAAA<\client_id><server_address>10.0.0.120<\server_address><stream_type>raw_http<\stream_type><\stream>". The system cannot find the path specified'. Process tvPlayer.exe (3560)


Realman wrote:1. What version DVBLink Connect Server, DVBLink Source is used?
2. There can be trial version dvblink ended?
Set log level to Info and attach log file.

1. Version = 4.1.0
2. I'm not using the trial

Log file attached, but it doesn't tell me much... :cry:
tommer
 
Posts: 18
Joined: Sun Feb 06, 2011 11:18 pm

Re: Indirect http streaming

Postby Realman » Wed Apr 11, 2012 7:14 am

Attach log file to this topic.
Realman
 
Posts: 805
Joined: Fri Mar 07, 2008 7:57 am

Re: Indirect http streaming

Postby Wal » Wed Apr 11, 2012 5:21 pm

Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  responseXML : TXMLDocument;
  request : TStringList;
  data : TStringList;
  url         : String;
begin
  responseXML := TXMLDocument.Create(nil) ;
  request := TStringList.Create;
  responseXML.Active := true;

  data := TStringList.Create;
  data.Add('<?xml version="1.0" encoding="utf-8" ?>'
  + '<stream xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dvblogic.com">'
  + '<channel_dvblink_id>' + chl + '</channel_dvblink_id>'
  + '<client_id>AAAAAAAAA</client_id>'
  +'<server_address>'+ '10.0.0.120' +'</server_address>'
  +'<stream_type>' + 'raw_http' + '</stream_type>'
  +'</stream>');

  request.Append(data.Strings[0]);
  request.SaveToFile(extractfilepath(application.exename) + 'playRequest.xml');

  data.Strings[0] := 'command=play_channel&xml_param=' + data.Strings[0];

  url:='http://10.0.0.120:8080/cs/';

  (responseXML as IXMLDocumentAccess).DOMPersist.loadxml(idHttp.Post(url, data));
  responseXML.SaveToFile(extractfilepath(application.exename) + 'playResponse.xml');

  data.Free;
  request.Free;
  responseXML.Free;
end;


This Code is working.
Kaum macht's man richtig, funktioniert es auch. o(°:°)o

Server: ASRock AMD 3GHz 6-Core Win7 U 64, DVBLink 4.5 Server, Source, ConnectServer
Clients: ASRock AMD 3GHz 6-Core , ASUS AT5IONT-I Win7 U 64, NEC Beamer, IPhone4 32MB, ACER Iconia Tab A200
Wal
 
Posts: 60
Joined: Fri Nov 11, 2011 7:46 pm

Re: Indirect http streaming

Postby tommer » Wed Apr 11, 2012 9:12 pm

Wal wrote:This Code is working.


It very close, but I'm getting HTTP as response:
<?xml version="1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="UTF-8" />
<title>Channels and guide - DVBLink Client</title>

<link type="text/css" href="/styles/black-tie/jquery-ui-1.8.7.custom.css" rel="stylesheet" />
<link type="text/css" href="/styles/ui.jqgrid.css" rel="stylesheet" />
<link type="text/css" href="/styles/jstthemes/classic/style.css" rel="stylesheet" />
<link type="text/css" href="/styles/base2.css" rel="stylesheet" />

etc...


Am I posting to the wrong address/port or?

When I'mtryingto attach the log file I'm getting: The extension log is not allowed
tommer
 
Posts: 18
Joined: Sun Feb 06, 2011 11:18 pm

Re: Indirect http streaming

Postby Oberon » Wed Apr 11, 2012 9:17 pm

tommer wrote:When I'mtryingto attach the log file I'm getting: The extension log is not allowed

You need to zip the log.
Oberon
 
Posts: 11763
Joined: Thu Sep 06, 2007 5:04 am

Re: Indirect http streaming

Postby tommer » Wed Apr 11, 2012 9:52 pm

Attached
Attachments
dvblink_server.zip
(28.06 KiB) Downloaded 713 times
tommer
 
Posts: 18
Joined: Sun Feb 06, 2011 11:18 pm

Re: Indirect http streaming

Postby Oberon » Thu Apr 12, 2012 11:44 am

tommer wrote:Attached

Your http post either does not have a dvblink command or command is not recognized (has some national characters?).
Oberon
 
Posts: 11763
Joined: Thu Sep 06, 2007 5:04 am

Re: Indirect http streaming

Postby Wal » Thu Apr 12, 2012 3:24 pm

I have here a testapp, with your code. It works at me.
Attachments
TestStream.zip
(78.27 KiB) Downloaded 744 times
Teststream.png
Teststream.png (31.4 KiB) Viewed 10658 times
Kaum macht's man richtig, funktioniert es auch. o(°:°)o

Server: ASRock AMD 3GHz 6-Core Win7 U 64, DVBLink 4.5 Server, Source, ConnectServer
Clients: ASRock AMD 3GHz 6-Core , ASUS AT5IONT-I Win7 U 64, NEC Beamer, IPhone4 32MB, ACER Iconia Tab A200
Wal
 
Posts: 60
Joined: Fri Nov 11, 2011 7:46 pm

Re: Indirect http streaming

Postby tommer » Thu Apr 12, 2012 9:11 pm

Wal wrote:I have here a testapp, with your code. It works at me.


Works like a charm :)

Must have been something wrong with my TidHttp setup...

Thanks!
tommer
 
Posts: 18
Joined: Sun Feb 06, 2011 11:18 pm

Re: Indirect http streaming

Postby Wal » Fri Apr 13, 2012 9:38 am

tommer wrote:
Wal wrote:I have here a testapp, with your code. It works at me.


Works like a charm :)

Must have been something wrong with my TidHttp setup...

Thanks!


The testapp has an error. :oops:

responseXML := nil; not responseXML.free;
resultXML := nil; not resultXML.free;
Kaum macht's man richtig, funktioniert es auch. o(°:°)o

Server: ASRock AMD 3GHz 6-Core Win7 U 64, DVBLink 4.5 Server, Source, ConnectServer
Clients: ASRock AMD 3GHz 6-Core , ASUS AT5IONT-I Win7 U 64, NEC Beamer, IPhone4 32MB, ACER Iconia Tab A200
Wal
 
Posts: 60
Joined: Fri Nov 11, 2011 7:46 pm

Next

Return to Development corner

Who is online

Users browsing this forum: No registered users and 1 guest