News:

Follow SMF on Twitter.

Main Menu

Radio for smf

Started by Mr.FixIT, February 05, 2013, 03:51:40 AM

Previous topic - Next topic

Mr.FixIT

Updated Code...2.9.2013:
Add your own asx links and add name of the asx to option area.  This is final to me.  Hope everyone enjoys this addon.  Thanks goes out to mashby for advice.  Tested on my site which has smf 2.0.4 in portal block using firefox, ie9 and chrome.  Also worked on friends site which has Drupal so that was nice to know for gp.

<DIV align="center" style="color:#435BB3;"><P align=center>Radio</P></DIV>
<DIV align="center" style="color:#fff;">
<P align=center><SELECT onchange=PlayIt(this.value) name=player>
<OPTION value="#">= Select Channel =</OPTION>
<OPTION value="link here.asx">1. music1</OPTION>
<OPTION value="link here.asx">2. msuic2</OPTION>
<OPTION value="link here.asx">3. music3</OPTION>
</SELECT>&nbsp; <SPAN style="FONT-WEIGHT: bold"></SPAN></P></DIV>
<DIV id=music style="TEXT-ALIGN: center">
<P>
<OBJECT id=MediaPlayer2 codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701" type=application/x-oleobject height=200 standby="Loading Microsoft WindowsÃ,® Media Player components..." width=300 classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95>
<EMBED height="200" width="300" showstatusbar="1" url="" uimode="full" showcontrols="true" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" type="application/x-mplayer2" loop="False" autostart="True"></EMBED></OBJECT></P></DIV>
<DIV style="TEXT-ALIGN: center">&nbsp;</DIV>
<DIV style="TEXT-ALIGN: center"></DIV>
<P style="TEXT-ALIGN: center">
<SCRIPT type=text/javascript>
function PlayIt(what){
document.getElementById('music'). innerHTML='<object width="300" height="200" '
      +'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" '
      +'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" '
      +'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
      +'<param name="url" value="'+what+'">'
      +'<param name="uiMode" value="full">'
      +'<param name="autoStart" value="true">'
      +'<param name="loop" value="false">'
      +'<embed type="application/x-mplayer2" '
      +'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
      +'showcontrols="true" uimode="full" width="300" height="200" '
      +'src="'+what+'" autostart="1" loop="False">'
+'</OBJECT>'; }
</SCRIPT>
</P>


Pic of my radio...
http://i45.tinypic.com/kdl4cx.jpg

kat

I moved this to "Tip and tricks", coz the "Feature requests" board is for requesting features to be included in the next version of SMF.

Thanks for that, though! :)

kat

Quote from: Mr.FixIT on February 05, 2013, 03:38:48 PM
Thank you for moving my post....sorry still getting use to your forum here. 

No sweat, mate. I've been here for eight hundred years and some of it still baffles me. ;)

mashby

I like the concept for sure. As a portal block bit of code, there's a lot of unnecessary bits and pieces. The whole thing is wrapped in <center> which is deprecated. The <html> part, the <head> part, the <body> part all exist before you even put your code in the portal block. I'm imagining the code you supplied work, but it's rather non-standard in terms of a portal block. You should consider removing a lot of this before using on a portal block. I sure appreciate your efforts though! :)
Always be a little kinder than necessary.
- James M. Barrie

Mr.FixIT

#4
Updated first post with updated code.  Thanks mashby for your advice.   ;)


Realinfo

also tell some websites from where we can get streaming link

prozacer

Finally, I found it! Thank a lot

Black Tiger

Sorry to bump this thread, but I love this and thread and no radio mod was made yet. :-\
But luckily there is this code! :D

I only got 1 question. On Vbulletin I had a radio mod which kept on playing music, also when I was visiting other parts of the forum, so when switching to another thread of forum.

Today I implemented this code and it works fine as long as you stay on the same page. As soon as you open a thread the page gets reloaded and radio stops working. You have to select the station again.
I'm working with Simpleportal, maybe that has something to do with it.

Is there a way to fix this so the radio will keep on playing also when visiting other threads and forum sections?
Greetings, Black Tiger

Jade Elizabeth

You could have it play stream in a new window, thats how modern stations do it.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Black Tiger

Thank you Jade. However in that case the users should have their popup killers disabled. Would be nice though.
I only don't know how to write this so it will become a new window.
Greetings, Black Tiger

Bigguy

I have an OLD radio mod from years ago. I have not tried it since torniyo left my site. Not sure if it could be updated or not. I can look into it I guess and see whats going on.

Jade Elizabeth

You would only run into that if you're forcing the radio on viewers, which is wrong. You should have a link that opens the stream in a new window - no issue there.

Look at how this site does it:
http://www.fox.com.au/ (click listen now in the header)

Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Black Tiger

I don't want to force it onto my users.
The fox.com.au site uses a complete new page withtout the old page present, so that's not what I want.
We've got a forum for posting and want the music on the background for visitors. So maybe a little small extra window would be nice as a solution when they have selected the station they want to listen to.
However, the vbulletin mod was just in the portal and no new window was necessary, that would be ideal.

This piece of code works the same, except for the radio being stopped by visiting another thread. Maybe that was fixed by a cookie or a session thing, I don't know. Over at Simpleportal I got some help which might have fixed it with implenting a cookie.

@Bigguy: Maybe you mean an old SMF 1.1. radio mod? In fact this current code is fine, I only need a solution so radio will keep playing when looking at other parts of the forum.
Greetings, Black Tiger

Jade Elizabeth

Yes but you can make it say that it's a radio page for x site, and it will always be playing in the background, and you can have it auto load in the background too :). And it would be nice to customise it with your own stuff, you can have Slammeddimes recenttopics on it or something so it automatically updates a list of topics....that way if people close your site to listen they still see those topics and may come back :D.

I would assume for what you want though, you would need some sort of javascript or framesets....or perhaps an iframe or something.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Black Tiger

I've read something about it, to have it play in a little separate windows, an iframe would be nice. But I want to put my own choice of radio stations in there. So this piece of code is good enough (except for Google Chrome which does not work since the npapi is disabled).

However, an iframe for this code would be nice. I'm just waiting for it.
Greetings, Black Tiger

margarett

Quote from: Black Tiger on December 14, 2015, 07:10:47 PM
Today I implemented this code and it works fine as long as you stay on the same page. As soon as you open a thread the page gets reloaded and radio stops working. You have to select the station again.
There is just no good way to do it in SMF (and, AFAIK, also not directly in vB).

When SMF changes a page, a new page requests starts in index.php, which then performs all the why's and why-not's until you see the new page contents. That means that your browser, which has requested the radio when the last page loaded, will receive a new request and that will reset the "radio session".

For that to work, you need to load the player in your page (eg: index.html) and the forum needs to run inside an iframe or similar. That way the player is loaded with the "main page" while SMF is loaded in the iframe. When there is a page change in SMF only the iframe's content changes but the main page is still the same so the player keeps playing.

edit: ninja'd :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Black Tiger

I'm going to do it in a seperate window, it's the best way and easy to implement.;)
Greetings, Black Tiger

Jade Elizabeth

See I'm not crazy, and you can make the best of a ******ty situation too by putting recent topics in there and making it branded and stuff :D.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Black Tiger

I never said or thought you were crazy. It's a nice idea! ;)
Greetings, Black Tiger

Jade Elizabeth

Ha ha I know, it's just something we Aussie's say when someone says no to our idea then later agrees with it. We're weird like that ha ha.

I wish I could offer a better solution but honestly it would slow you down and annoy people so I would avoid what you're trying to do. Also it would be a HUGE pain to maintain and operate so yeah.

I actually used to do internet radio and I had something on my forum to show on or off air buttons but the radio would load in Winamp. Also the service that allowed the on and off air buttons has since closed. It was a lot of fun.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Advertisement: