Skip to Content
It is currently March 22nd, 2019, 8:38 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: January 11th, 2019, 3:11 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 83
How would I go about embedding a player, such as what you see on sites like http://parkmagicradio.ca:8000/1/, or http://parkmagicradio.ca:8000/?type=http? I'm not using Cloud, and I'm hosting the site and SAM myself (not using an ISP or audio host).

Rather than having it open a listen.pls file into a separate application like VLC to play, I would like to have it as a small player on the menu, that is initially stopped, but the listener has to press the Play button to start listening.

It would be interesting to find out how others of you are doing this with your sites.

Thanks!

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: January 11th, 2019, 4:15 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 83
Ok, I found the basic code that I want to use:

Code:
<audio id="player" controls="controls" preload="none" autoplay>
   <source src="http://parkmagicradio.ca:8000/1" controls autoplay preload type="audio/mpeg">
   Your browser does not support the HTML5 audio tag.
</audio>


But I want to be able to change the height and width and haven't quite figured that out yet. Looks fine in all my browsers though!

I'm not home and have no access to my computer now so I'll have to try this later tonight.

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: January 14th, 2019, 3:32 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7774
Location: Aachen (Germany)
Basically you can start with width and height attributes or you use the style attribute and set width/height using CSS.
More styling options are explained over here:
https://serversideup.net/style-the-html ... o-element/

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 14th, 2019, 9:28 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 83
I found a Shoutcast player generator, but it uses Flash:

http://www.shouthost.com/freeflashplayer/

However, in its default player code, you have a choice of player styles, which I like. Then I had to figure out where I wanted it placed. Right now it's at the top of my page, and you have to click on the Play button on it after you enable Flash on the page in Chrome. It only takes a second, but I would prefer if someone loads the page that it start playing automatically. It works without clicking the Play button after Flash is enabled in Edge.

Once the song changes, the player stops playing and you have to hit Play again, and it disconnects the listener from the stream and reconnects him (or her) again. ARG!

I thought about displaying the player in an iFrame but can't figure out the code. I'll keep at it unless someone out there can let me know how to do it.

Thanks,
Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: January 14th, 2019, 10:32 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 83
I have an iFrame going... but it looks different in different browsers.

Interesting... if I'm NOT on my main page when the current song ends and the new one starts, the stream stays connected.

Dang... why can't they make it easier??? LOL!

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: January 15th, 2019, 5:10 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7774
Location: Aachen (Germany)
There are commercial players available with "nicer"/custom layouts.
Don't take the Flash route. Firefox will dump flash in September, Chrome will follow by the end of this year and Adobe (the makers of Flash) has announced the EOL for Flash to be with the new year 2020 for home users and the end of 2020 for enterprise customers.

Any HTML5 or Flash will stop playing when you have "normal" navigation that reloads the full page on every link click. In that case you can only put the player in a popup.
If you use an AJAX navigation (javascript that only reloads parts of the page) you can get around that by creating the Audio Element using JavaScript instead of as an HTML element and designing your own custom controls.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 15th, 2019, 8:12 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 83
I DID IT!

I successfully created a popup player for my website! Now if someone hits the "Listen" link in the menu, it opens a popup player and it auto-plays in Chrome and Firefox, but not Edge or Internet Explorer (you still have to hit the Play button with those two browsers). I'm very pleased with myself for not breaking my php pages! LOL!

I ended up using the code provided on this page, and replacing the code they have under Player Code with the HTML5 code above:

https://www.shoutcheap.com/how-to-creat ... d-icecast/

It's not perfect, but it works. If anyone wants any help setting this up for their own site, please let me know!

Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: January 16th, 2019, 3:29 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7774
Location: Aachen (Germany)
AutoPlay will be disabled in future releases of Firefox and Chrome as well. (In Chrome it actually depends on whether you have interacted enough with the page in advance to see that as a trigger for the playing)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 16th, 2019, 8:39 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 83
Mastacheata wrote:
AutoPlay will be disabled in future releases of Firefox and Chrome as well. (In Chrome it actually depends on whether you have interacted enough with the page in advance to see that as a trigger for the playing)


I suppose that a frame might be better when that happens, where the person viewing would have to push "Play" before he can hear anything. It won't be a huge loss. Eventually someone will come out with some better language and do it some other way for those who still want it.

What a relief though, knowing what I have done actually works! And I know almost nothing about javascript or PHP!

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: January 17th, 2019, 5:11 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7774
Location: Aachen (Germany)
I think your popup solution works because you actively trigger the new window to open and that counts as an activity for the autoplay.
IFRAMEs aren't gonna help you, they change and are reloaded whenever you click a link as well.
The only solution is to have both a JavaScript-based no-reload navigation and a player that is rerendered, but not restarted when you navigate.
For an example of how something like that can look, check out kwevradio.com where I built a custom minimalist player for a customer into his wordpress site that keeps playing while navigating through the site.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group