My Own Media Player within Demopad

Share projects you have created or look at projects that others have made.
Post Reply
starwarsmike
Posts: 146
Joined: Mon May 13, 2013 12:48 pm

My Own Media Player within Demopad

Post by starwarsmike » Tue Oct 14, 2014 8:44 pm

Hi

I thought I would post some photo's throughout the process of creating my own Media Player within Demopad. For those who did not see my post on the help forum.

I am going to use MCE controller software, which will handle the commands sent from Demopad, to play/start the desired song. Once Demopad sends the command, the desired song will start on your PC default media player. My Pc sound card has an optical out, which I will use to connect to my sound system. An example command within MCE controller software would be;

<StartProcess Cmd="Start_ADELE" File="E:\Music\Adele\21\01 Rolling in the Deep.wav" />

Command to send to the MCE controller from Demopad, is simply "Start_ADELE"

Yes I know, I will need to enter a command for every song I have, but if you choose your top 40 album, x 10 songs, = 400 commands, a lot of the work is just is copy and paste.

What Iv'e done so far;

>Setup MCE controller as a Demopad Device
>Created a page design, all buttons on left are highlighted when pressed, update green & red, if on or off status
>Added 40 artists with artist covers to subpage, using scroll option
>Added Subpage to my main project

Still to do:

>Create Albums Page for each artist
>Create Songs page for each album per artist
>Creates Genre Page
>Create Playlist
>Create HD Tracks Page
>Create various flags to update now playing artwork at bottom left of the page
>Create pages for each alphabetical order
>Setup commands/flags for all above
>finally add all songs to MCE Controller & Demopad

Sure plenty more, the more I get into this, will update more photo's as the project progresses

I would appreciate if anyone could suggest as any ideas or further development I could add

image.png
image (1).png
You do not have the required permissions to view the files attached to this post.
Last edited by starwarsmike on Tue Jun 16, 2015 12:59 pm, edited 1 time in total.

Idealhomes
Posts: 144
Joined: Mon Jul 16, 2012 3:35 pm
Location: New Zealand
Contact:

Re: My Own Media Player within Demopad

Post by Idealhomes » Wed Oct 15, 2014 7:28 am

Well done, there's a lot of hours put into that setup :) I use the same background for our installations, gotta love the speaker grill :lol:
"Setting the Standard in Quality and Commitment"

Idealhomes
Posts: 144
Joined: Mon Jul 16, 2012 3:35 pm
Location: New Zealand
Contact:

Re: My Own Media Player within Demopad

Post by Idealhomes » Wed Oct 22, 2014 9:20 am

I'm going to be cheeky and ask....where did you get the square/rectangle on/off (red green) icons on the left hand buttons? I have round ones, but do like the looks of those square ones 8-)
"Setting the Standard in Quality and Commitment"

starwarsmike
Posts: 146
Joined: Mon May 13, 2013 12:48 pm

Re: My Own Media Player within Demopad

Post by starwarsmike » Thu Oct 30, 2014 10:54 pm

Hi Ideal Homes

Sorry didn't see your post. Email me at murphy-michael3@sky.com & I will email them to you.

Cheers

Michael

rajkhurana
Posts: 6
Joined: Tue Jun 10, 2014 8:57 am

Re: My Own Media Player within Demopad

Post by rajkhurana » Thu Dec 18, 2014 5:53 pm

Hi,

I am intrested to know how you log on to the PC ans send command.

Can you send me a copy of the script you added.

Great piece of work.

Raj

starwarsmike
Posts: 146
Joined: Mon May 13, 2013 12:48 pm

Re: My Own Media Player within Demopad

Post by starwarsmike » Sun Dec 21, 2014 3:21 pm

Hi Raj

Download this software, MCE Controller

https://mcec.codeplex.com/

& setup and device, using your PC IP address, (setup your PC with static IP address), juts google it, if require info.

Suffix - \x0D\x0A
Port - 5150
I tick box Maintain active connection, but is up to you

Make sure on the MCE controller setting, that you set the port to 5150, same as above

& use these demopad commands

You can Edit the MCE controller file; (C:\Program Files (x86)\Kindel Systems\MCE Controller), and add more commands, like to start a certain song of App, e.g.

<StartProcess Cmd="Start_ADELE" File="E:\Music\Adele\21\01 Rolling in the Deep.wav" />
You do not have the required permissions to view the files attached to this post.

starwarsmike
Posts: 146
Joined: Mon May 13, 2013 12:48 pm

Re: My Own Media Player within Demopad

Post by starwarsmike » Tue May 19, 2015 4:51 pm

IMG_0063.PNG
IMG_0062.PNG

Example of my Album pages
You do not have the required permissions to view the files attached to this post.

starwarsmike
Posts: 146
Joined: Mon May 13, 2013 12:48 pm

Re: My Own Media Player within Demopad

Post by starwarsmike » Sat Aug 29, 2015 10:27 am

I hope this helps someone along the way to build their own Media player.

How did I program this media player to play songs on my UPNP Streamer, which accessed songs from my NAS drive.

Here you go............

First i used Developer Tools for UPnP™ Technology Tools, free from the internet, & Wireshark, once you have found and captured one song, then the rest should be straight forward, see further below

Here is what i captured (note current URl below, this is the root of the song on my NAS drive (will explain later how to find this information)

Original XML

&r:KE.@E0|]/EP>[POST /AVTransport/ctrl HTTP/1.1
HOST: 192.168.1.190:8080
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
CONTENT-TYPE: text/xml; charset="utf-8"
Content-Length: 503

<?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.100:9000/disk/DLNA-PNM ... CurrentURI>
<CurrentURIMetaData />
</u:SetAVTransportURI>
</s:Body>
</s:Envelope>

In Demopad format

POST /AVTransport/ctrl HTTP/1.1\x0D\x0AHOST: 192.168.1.190:8080\x0D\x0ASOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"\x0D\x0ACONTENT-TYPE: text/xml; charset="utf-8"\x0D\x0AContent-Length: 503\x0D\x0A\x0D\x0A<?xml version="1.0" encoding="utf-8"?>\x0D\x0A<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encodin ... ansportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">\x0D\x0A<InstanceID>0</InstanceID>\x0D\x0A<CurrentURI>http://192.168.1.100:9000/disk/DLNA-PNM ... RIMetaData />\x0D\x0A</u:SetAVTransportURI>\x0D\x0A</s:Body>\x0D\x0A</s:Envelope>

You will now probably have to capture the play command, which will be send straight after to send the command above. To do this, there is a tool in the download developers tool called av wizard. select your UPnP device from the control app. Play a song normally with your remote, then use the Stop button on the av wizard, the run wirelshark and hit the Play button on av wizard. find the data in wireshark, which will look something like this...

&r:KEF&@mi[>|EPy3POST /AVTransport/ctrl HTTP/1.1
HOST: 192.168.1.190:8080
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Play"
CONTENT-TYPE: text/xml; charset="utf-8"
Content-Length: 356

<?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:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
<InstanceID>0</InstanceID>
<Speed>1</Speed>
</u:Play>
</s:Body>
</s:Envelope>

In demopad format

POST /AVTransport/ctrl HTTP/1.1\x0D\x0AHOST: 192.168.1.190:8080\x0D\x0ASOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Play"\x0D\x0ACONTENT-TYPE: text/xml; charset="utf-8"
\x0D\x0AContent-Length: 356\x0D\x0A\x0D\x0A<?xml version="1.0" encoding="utf-8"?>\x0D\x0A<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encodin ... x0A<u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">\x0D\x0A <InstanceID>0</InstanceID>\x0D\x0A<Speed>1</Speed>\x0D\x0A</u:Play>\x0D\x0A</s:Body>\x0D\x0A</s:Envelope>

You can repeat this process for command like stop/pause/skip etc.

So, you now have a command to play a song & command to play it. Setup a button (song name) sent the song command, then sent the play command half second later.

Next, you don't have to capture every song, use one of the developers tools called av media controller. click on Content Directories, your NAS should be there, click music, All tracks, find your song and right click it, hit resources, then you can see the content uri something like this,
http://192.168.1.100:9000/disk/DLNA-PNM ... 034380.mp3

You copy and paste this into the above song command format, you might need to change the content length, I didn't, i just increased it by 10, e.g. the content length above is 503, when i copied and pasted my next song, i changed the content length to 513. It worked for me, not saying it will for everyone.

How to calculate content length

Morning Michael,

Glad it worked! Very strange that they all worked however… I thought only the last one I sent you would have worked because the others had varying content lengths..

So question is, I think i will need to change the content length each time pending on the length of the above HTTP, how do i check what the content length of a command?

Considering the content-lengths worked on the others I sent you, it gives the impression that as long as the content-length is equal-to or longer than the http data it’ll work. So with that being said, you could cheat the system and just use a large content-length that never changes.. Or, do it properly as follows:

Take all the data after the header part, so from <?xml… all the way to </s:Envelope> and count the number of characters using an online tool or similar (http://www.charactercountonline.com/ this one seemed to do the trick).

Once you have that number, take the xml in it’s proper form i.e:

<?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.100:9000/disk/DLNA-PNM ... CurrentURI>
<CurrentURIMetaData />
</u:SetAVTransportURI>
</s:Body>
</s:Envelope>

then for each line, add two characters (for the CR/LF), so the total length for the above xml would be 485 + 2 * 9 (ignore the last line) which is 503.

I am sure there is much easier ways to the highly skilled out there....

Michael

User avatar
Cheesegeezer
Posts: 47
Joined: Wed Mar 02, 2016 10:15 pm
Location: On an oil rig somewhere

Re: My Own Media Player within Demopad

Post by Cheesegeezer » Sun Dec 02, 2018 4:15 am

Wow is all i can say. I guess it works with playlists too.

You got me thinking now. You could probably create html and javascript to do this also, host the site locally using xammp and set a web page interface in Demopad.

I’m gonna get on it after I finish my new UI projects.

Thanks for the inspiration ;)

tharlin
Posts: 7
Joined: Fri Jun 01, 2018 9:51 pm

Re: My Own Media Player within Demopad

Post by tharlin » Thu Dec 20, 2018 7:48 pm

Note that you can use the super-double-secret keywords [#CONTENTLENGTH] and [#HOST] when formatting HTTP payloads in the DemoPad designer.

Post Reply