• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Embed source problems

-Cryptic-

Weaksauce
Joined
Jan 28, 2006
Messages
66
K so i have embeded sources linked to m3u files but my question is how do i code the players so that when they play one embeded source and they want to play another that they dont play play at the ssame time. The problem I have right now is that they can click on one and will just play. Click on another and its playin along side that one. Is there a way to code the players so that when one is playing and they click on another that one stops and the new one they clicked on plays?
 
We need, to be modest, a bit more information.

What are you talking about? What kind of sources? (I'm guessing audio files since m3u is usually a playlist).
What kind of player? What is it coded in?
What are you making?

(You do sort of live up to your name.)
 
Im using embeded audio files that link to the m3u file. There windows media players. What I'm trying to do is have the embed sources stop playing when someone clicks on another embed source to play it. Its coded in html and css. Here is the current problem when people click on a song it plays. Then when they click on another song it plays too. So both song are playin at the sametime over lapping each other. What I want to do is code it so that when that song is playing and they click on another one it stops playing and the new one they click on starts playing.
 
It's possible to do what you want, but more info still needed.

Do you want to specifically load the m3u files with the windows media plugin? Quicktime is usually the plugin that handles m3u files (audio/x-mpegurl).

The Windows Media plugin can indeed embed m3u files, but the plugin doesn't actually report to the browser that it supports m3u files. For the windows media plugin, you should really be using a .wax, .wvx or .asx playlist file depending on whether you are embedding audio ( like wma or mp3), wmv files or asf video files. The quicktime plugin actually reports that it supports m3u files.

You need to decide what plugin you want to target first as the 2 plugins have different scripting methods. Also note that for the Windows Media plugin, scripting is quite broken in Firefox ( unless you use the wmp activex plugin for firefox) and for Opera you have to load an applet to turn on event callbacks to do what you want. This means that you basically limit the functionality of your script to IE or Opera on windows when Java is turned on and present, with a chance at Firefox if the visitor has the WMP activeX plugin installed.

Now, if you use the quicktime plugin, you might have better luck across browsers ( on windows at least), but you still might be leaving linux browsers out as the audio/x-mpegurl plugins on linux might not support scripting like the quicktime plugin.

I can try to set up an example, but:

What type of files are you embedding with the m3u playlists?
What plug-in do you want this working in?
What browsers?

Now, if I remember correctly, the realplayer plugin can do what you want without scripting (I'll have to check and let you know) and it works across all major browsers and on linux and mac.

The realplayer plugin is crappy itself, but sometimes provides better support across browsers. You'd want to use rpm playlist files that link to rm and ra files.

The simple solution is to just put a link on the page to the m3u file and let it open in the visitor's default program instead of embedding in a web page.

A better option might be to have only one player embedded into the document at one time. Have the vistior click a button to switch to a different playlist. When that happens, the current player could be removed from the document and another could be embedded in its place.

Of course, you might as well jump on the bandwagon and set up a flash player that plays your files. Then, you can do what you want.
 
Here's an example using the quicktime plugin.

test.html
Code:
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>title</title>
        <script type="text/javascript">
            window.onload = function() {
                var e0 = document.embeds[0];
                var e1 = document.embeds[1];
                document.getElementsByTagName("button")[0].onclick = function() {
                    e1.Stop();
                    e0.Play();
                };
                document.getElementsByTagName("button")[2].onclick = function() {
                    e0.Stop();
                    e1.Play();
                };
                function stopAll() {
                    e0.Stop();
                    e1.Stop();
                }
                document.getElementsByTagName("button")[1].onclick = stopAll;
                document.getElementsByTagName("button")[3].onclick = stopAll;
            };
        </script>
    </head>
    <body>
        <p><embed type="audio/x-mpegurl" src="http://shadow2531.com/opera/testcases/plugins/quicktime/001.m3u" autoplay="false" enablescripting="true" width="300" height="25" bgcolor="#ffffff"></p>
        <p><button>Play</button> <button>Stop</button></p>
        <p><embed type="audio/x-mpegurl" src="http://shadow2531.com/opera/testcases/plugins/quicktime/001.m3u" autoplay="false" enablescripting="true" width="300" height="25" bgcolor="#ffffff"></p>
        <p><button>Play</button> <button>Stop</button></p>
    </body>
</html>

You need to have quicktime (or quicktime alternative) installed and have its browser mime types settings set so that m3u file support is turned on.

That works in IE7 and FF 2. Will work in Opera 9 once a bug is fixed.

This example uses the same m3u file for both objects, but it still shows what you want.

Each stop button stops both players from playing.
Each play button stops the other player and starts its player.

Set controller="false" on the embed element so that the quicktime interface is hidden, so that only the buttons are shown.

To get it to work like that when you click on the play button on the quicktime object itself, is more difficult.
 
wow thank you so much. I'm gonna play with the code and see what I end up with. I'm linking mp3 to the m3u file. Also I did try that wax file thing but it didnt work to well cuz i really didnt know what the hell i was doing
 
wax files are asx playlsts for audio. They technically should only point to .wma files when embedding, but you can ignore that.

playlist.wax
Code:
<Asx Version="3.0"> 
    <Entry> 
        <Ref href="http://shadow2531.com/opera/testcases/plugins/quicktime/000.mp3"/>
    </Entry>
</Asx>
(just add more entry elements to load more files in the playlist)

If you use a .wax file, you need to configure your server to send the .wax extension with a mime type of audio/x-ms-wax

Then, you'd do <embed type="audio/x-ms-wax" src="playlist.wax" width="300" height="70"> for example. ( and possibly nest that inside an object element with a wmp classid for IE's sake.)

If IE has a fit about type="audio/x-ms-wax", you can try application/x-mplayer2.
 
Back
Top