...

View Full Version : embed .pls



philmetz
12-29-2010, 05:03 PM
Is it possible to embed a pls link in javascript?

I tried this but doesnt seem to work, what can i do?



function Play () {
var path = '<embed src="http://www.link.com/music.pls" autostart="true" loop="false" hidden="true" height="0" width="0">';
document.getElementById (file).innerHTML = path + '<img src="images/stop.gif" style="cursor:pointer;" onclick="Stop(' + "'" + file + "'" + ')">';
}
function Stop (file) {
document.getElementById (file).innerHTML = '<img src="images/play.gif" style="cursor:pointer;" onclick="Play(' + "'" + file + "'" + ')">';
}

philmetz
12-29-2010, 06:42 PM
Think its impossible, but it should be possible to play .pls or .asx, any ideas?

rnd me
12-29-2010, 07:07 PM
you can use <audio> tags, or a an existing player like jPlayer.
you have to load the pls file with ajax, parse out the media locations, and build a playlist that feeds the audio player.

philmetz
12-29-2010, 07:32 PM
thats what i cant find, a tutorial of even better an example to work off? not experienced in that

Sciliano
12-29-2010, 07:51 PM
Cross Browser Media Player with Select List and .wax Playlist


<!DOCTYPE HTML>
<html>
<head>
<title>Cross Browser Media Player with Select List and .wax Playlist</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">

// Local folder was used for testing
// Change to the media files path on your site, or local machine;
var mediaPath = "c:/Documents and Settings/ABC.SELF-C18DAAD6BD/Desktop/My Site/media/";

/* ********* Do not edit below this line ************* */

var mediaFileName = "";
var playerEmbedStr = '\<embed type="application\/x-mplayer2" width="325" height="52" showstatusbar="1" enablecontextmenu="false" src="mediaFileName"\>\<\/embed>';

function swapMedia(nSong,nContainer){

var activePlayerStr = playerEmbedStr.replace("mediaFileName", mediaPath + nSong);
nContainer.innerHTML = activePlayerStr;
self.focus();
}

function init(){

document.forms[0]['songList'].onchange = function()
{
if (this.value != "")
{
swapMedia(this.value,document.getElementById('playerContainer'));
}
}
}

navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false);

</script>
<style type="text/css">

body {background-color: #fffacd; margin-top: 60px;}
form {width: 350px; margin-left: auto; margin-right: auto; margin-top: 25px;}
select {width: 325px;}
#playerContainer {width: 350px; margin-left: auto; margin-right: auto;}

</style>
</head>
<body>
<div id="playerContainer">
<embed type="application/x-mplayer2" width="325" height="45">
</embed>
</div>

<form action="">

<select name="songList">
<option value=""> Choose a Song </option>
<option value="play_list_1.wax"> Play All </option>
<option value="song1.mp3"> Don Henley - Heart of the Matter </option>
<option value="song2.mp3"> Jackson Browne - The Pretender </option>
<option value="song3.mp3"> Lucinda Williams - World Without Tears </option>
</select>

</form>
</body>
</html>


play_list_1.wax


<asx version = "3.0">
<entry>
<ref href = "c:/Documents and Settings/MJH.SELF-C18DAAD6BD/Desktop/My Site/media/song1.mp3"/>
</entry>
<Entry>
<ref href = "c:/Documents and Settings/MJH.SELF-C18DAAD6BD/Desktop/My Site/media/song2.mp3"/>
</entry>
<entry>
<ref href = "c:/Documents and Settings/MJH.SELF-C18DAAD6BD/Desktop/My Site/media/song3.mp3"/>
</entry>
</asx>

philmetz
12-29-2010, 08:19 PM
doesnt really work since you need the windows media plugin for other browsers. Im trying to play things like this: http://listen.di.fm/public3/trance.pls
in the browser?

rnd me
12-29-2010, 11:29 PM
doesnt really work since you need the windows media plugin for other browsers. Im trying to play things like this: http://listen.di.fm/public3/trance.pls
in the browser?

do you want the songs to play one at a time in the browser,
-or-
do you want to build a playlist that opens on a desktop player like itunes or winamp?

both are possible, but i'm not sure exactly what you want to do here...

checkout http://www.happyworm.com/jquery/jplayer/latest/demo-02.htm for an easy way to accomplish the first option.

philmetz
12-30-2010, 07:50 AM
The first option is what im trying to accomplish. So like i click play and it plays http://listen.di.fm/public3/trance.pls

Looked at your first solution but I think that needs the songs and doesnt accept pls or asx



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum