Radio Script

I have looked through the forums and tutorials I could find and can't find what I need. I want to make a widget that connects to a specific radio station and can not find how to do the script for the link, or anything on making a radio widget. Can anyone help or point me in the right direction?
5,242 views 18 replies
Reply #1 Top
Have you dissected _Martin_s radio player?
His stuff is usually pretty clear.

https://www.wincustomize.com/download.asp?p=sb&LibID=3&skinid=2721&file=dx2_radio.dxpack&source=1


Posted via WinCustomize Browser/Stardock Central
Reply #2 Top
I have tried to dissect a few. I'm not sure I am doing right. When I try to access the scripts, I can't find the one that shows the link to the station on the web. I just keep opening the image scripts.
Reply #3 Top
In the example I linked to there are three objects.

the first one is the background.

The second (Radio_station) loads the default station and has the MS Forms control to allow you to choose your station (I think). Line 21 has the link and uses the code in the sub starting on line 10 to grab the selected stream.

The third is teh WMP activeX control to actually play the thing but it mostly just turns off all the contols and viewer.

That may not be the best example because it looks specific to Virgin.

Here's another player: https://www.wincustomize.com/download.asp?p=sb&LibID=3&skinid=3543&file=kfi_radio.dxpack&source=1

Take a look at the script in the kfi_wmp object. The other objects are pretty clear.

Good luck


Posted via WinCustomize Browser/Stardock Central
Reply #4 Top
Techically, you should be able to just use the DXPlayer plugin to connect to it. Its a little more complicated than that, but I've been playing around with the idea myself, and thats the approach that I'm trying to use for it.
Reply #5 Top
DesktopX makes my head hurtFie
Reply #6 Top
What's teh URL of teh stream you want . . I'd work with you to come up with something.
Reply #7 Top
Thanks Zubar....here it is..it's http:// and then wxpnsc.streamguys.com:80/..tried to post it so you can see the address and not just the 'link' thingy.
Reply #8 Top
Basically, I have the 'skin' and all the object states, etc. The scripts are beyond me and I can't find the info any where.

I need to script everything...
1. Script the volume control. Just the button. (How do you make it slide in a straight line?...etc.)
2. The stop and play buttons. (I assume the script to link to the live feed would go with the play button?)
3. The lower right corner object to link to the stations website.
4. The lower left corner object to 'toggle' all the backgrounds you see at the bottom. This is probably the hardest, since so far I have made the current BG the parent.

I have the Backgound, volume bar, volume button, play button, stop button, link (>org button), and the toggle (philadelphia button) all as seperate objects.




I'd like to know how to do these myself, but if it's easier for someone to just do it themselves I can email you the files. Let me know.

Thanks.
Reply #9 Top
My notes (and please remember I'm a hack):
Changing the backgorund is not covered here . . . that may come later. You can shoot me a line via email if you need more/less help

All code and ideas are based on the KFI Radio object. All mistakes are mine.

I created a new object called WXPN_WMP, made it a child of the background
edited script
added Windows Media player activeX control
(as a test I entered the URL provided into the first field. Closed editor and applied. It played.) Nice music too.
So I have an ugly WMP player on my desktop, Control drag to make it bigger.
Put it over the bacground, resized to tiny and made it hidden (on the relations tab)

Create another object to be a volume bar
Slap it on the background, make it a child of it and all that
Create another object to be a slider. make it a child of the volume bar. Now it can only be dragged along it's path
edit script
'defines what object were affecting and the size of the bar I think
Sub Object_OnScriptEnter
Object.Left = (DesktopX.ScriptObject("WXPN_WMP").Control.Settings.volume /100*(137-Object.Width))
End Sub

'volume change
Sub Object_OnDrag(x,y,x2,y2)
Object.Top = Object.Top
If x2 < 0 Then Object.Left = 0
If x2 > (137 - Object.Width) Then Object.Left = (137 - Object.Width)
DesktopX.ScriptObject("WXPN_WMP").Control.Settings.volume = Object.Left / (137 - Object.Width) * 100
End Sub

Create a stop button object
edit the script
'create a function to stop
Function Object_OnLButtonUp(x,y,dragged)
If (dragged = False) Then
DesktopX.ScriptObject("WXPN_WMP").Control.Controls.Stop()
DesktopX.ScriptObject("radio_play").Object.States("").Opacity = 100
DesktopX.ScriptObject("radio_stop").Object.States("").Opacity = 40
End If
End Function

Create a play button object
edit the script
Function Object_OnLButtonUp(x,y,dragged)
If (dragged = False) Then
DesktopX.ScriptObject("WXPN_WMP").Control.Controls.Play()
DesktopX.ScriptObject("radio_play").Object.States("").Opacity = 40
DesktopX.ScriptObject("radio_stop").Object.States("").Opacity = 100
End If
End Function

Create a website object
Change the type from layer to URL.
Type in the URL
make it a child of the background.

Mostly done.
I have a copy of all the above if WC strips any of it.
Reply #10 Top
I got the first part..the xpn_wmp and it plays
Got the volume bar
The xpn_vol_slider is driving me insane. I'm gonna mess with it some more before I hit you up for help again. This has been a great help Zubaz. I wish I knew how to figure this out on my own.
Reply #11 Top

Mine is based off _Martins_ script.  It took a lot of playing around with it before I was finally done.

http://islanddog.wincustomize.com/ViewSkin.aspx?SkinID=695&LibID=34&comments=1

Reply #12 Top
For the record, I hacked up martin's script for my notes. . . it was very easy to understand.

Making the media player not visible was key and I was looking in the script for it. Duh!
Reply #13 Top
Okay! I have everything except the background toggle!!!

I've been playing with the settings for the 'philadelphia' object that I want to use to toggle the background images, but nothing. The most I figured out was how to hide the whole thing, which I don't wanna do.

And one little glitch. The play button keeps disapearing but will come back if I click the stop button. I'm guessing this has something to do with ripping the script from 'KFI Radio' since those buttons seem to react to each other.
Reply #14 Top
I was able to tweak paxx's 'Slideshow' script..Link

and the background can change on it's own. Really would like to be able to control which background you see. Trying to find something that will allow the 'philadelphia' object to stop the slideshow or go to next pic or even disable the script running on the background object where the slideshow script is.

Still can't solve the disapearing play button thing. When you load the radio, it automatically starts playing, but you can't see the play button. If you click the stop button, the radio stops and the play button apears. Then , you click the play button to start it again. But I know it shouldn't be that way.
Reply #15 Top
The code to stop play via the button is:
DesktopX.ScriptObject("WXPN_WMP").Control.Controls.Play()

Could you add that to the onscriptenter of the WMP activeX control to stop it from playing? Or perhaps better, set the playState of the activeX control to '1 - wmppsStopped'?
Reply #16 Top
Island Dog, Nice looking player.
Reply #17 Top
The code to stop play via the button is:

The stop button works. It's the 'play' buton. They both work but the play button can't be seen when you load the player. You have to click the stop button for it to apear and then it stays.

The rest of what you wrote may as well be in Chinese.



Island Dog, I hadn't realized you had a link in that post. That player was the first one I tried to disect...with no luck. It's nice. I still have it and listen to it once in a while.
Reply #18 Top

That player was the first one I tried to disect...with no luck. It's nice. I still have it and listen to it once in a while.

I understand what you mean.  I just wanted to make a simple radio player and that took me several days of playing with his script to get it right. 

Island Dog, Nice looking player.

Thank you.  It's my favorite radio station.