Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: embed .pls

  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question embed .pls

    Is it possible to embed a pls link in javascript?

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


    Code:
    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 + "'" + ')">';
    		}

  • #2
    New Coder
    Join Date
    Aug 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question

    Think its impossible, but it should be possible to play .pls or .asx, any ideas?

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,293
    Thanks
    10
    Thanked 583 Times in 564 Posts
    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.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    New Coder
    Join Date
    Aug 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    thats what i cant find, a tutorial of even better an example to work off? not experienced in that

  • #5
    Regular Coder
    Join Date
    Nov 2009
    Posts
    247
    Thanks
    4
    Thanked 22 Times in 22 Posts
    Cross Browser Media Player with Select List and .wax Playlist
    Code:
    <!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

    Code:
    	<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>
    Last edited by Sciliano; 12-29-2010 at 07:53 PM.

  • #6
    New Coder
    Join Date
    Aug 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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?

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,293
    Thanks
    10
    Thanked 583 Times in 564 Posts
    Quote Originally Posted by philmetz View Post
    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/jpla...st/demo-02.htm for an easy way to accomplish the first option.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #8
    New Coder
    Join Date
    Aug 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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
    Last edited by philmetz; 12-30-2010 at 08:00 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •