Bazzaah Posted April 6, 2011 Share Posted April 6, 2011 Hi I'm building a site that contains access to some mp3 files of people speaking English. I would like a media player that is able to handle a variable that results from a database search. I can use <a href etc> to link to the relevant file but would like to use a server-side player to stream the file, rather than the client's browser. Something like Dewplayer would be perfect but it seems only to take a static file (maybe I'm wrong there). The player appears within <object> tags, like this <code> echo '<object type="application/x-shockwave-flash" data="/player/dewplayer.swf" width="200" height="30" id="dewplayer" name="dewplayer">'; echo '<param name="movie" value="/player/dewplayer.swf" />'; echo '<param name="flashvars" value="mp3=file.mp3" />'; echo '<param name="wmode" value="transparent" />'; echo '</object>'; </code> (the code is freely downloadable so hope I'm not breaking any rules posting someone else's code here). Is there a way I can specify a variable in value? If not, does anyone know of a player that I can use that does allow that? Grateful for any help. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/232894-media-player-and-php-variables/ Share on other sites More sharing options...
bschultz Posted April 6, 2011 Share Posted April 6, 2011 <code> echo '<object type="application/x-shockwave-flash" data="/player/dewplayer.swf" width="200" height="30" id="dewplayer" name="dewplayer">'; echo '<param name="movie" value="/player/dewplayer.swf" />'; echo '<param name="flashvars" value="mp3=<?php echo $file; ?>" />'; echo '<param name="wmode" value="transparent" />'; echo '</object>'; </code> Link to comment https://forums.phpfreaks.com/topic/232894-media-player-and-php-variables/#findComment-1197808 Share on other sites More sharing options...
Bazzaah Posted April 6, 2011 Author Share Posted April 6, 2011 Thanks for that - unfortunately the code generates a parse error i.e. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' Any ideas? Link to comment https://forums.phpfreaks.com/topic/232894-media-player-and-php-variables/#findComment-1197819 Share on other sites More sharing options...
BlueSkyIS Posted April 6, 2011 Share Posted April 6, 2011 when posting an error, it is best to include the entire error, especially the line number. but taking a look at the code, this should be: echo '<param name="flashvars" value="mp3='.$file.'" />'; or the way I prefer to do it, using single quotes within tags: echo "<param name='flashvars' value='mp3=$file' />"; Link to comment https://forums.phpfreaks.com/topic/232894-media-player-and-php-variables/#findComment-1197871 Share on other sites More sharing options...
Bazzaah Posted April 6, 2011 Author Share Posted April 6, 2011 Thanks! I needed to use the first option but all is now well. Really appreciated - thanks again! Link to comment https://forums.phpfreaks.com/topic/232894-media-player-and-php-variables/#findComment-1197880 Share on other sites More sharing options...
Bazzaah Posted April 6, 2011 Author Share Posted April 6, 2011 Is there a way to mark the thread as solved? Link to comment https://forums.phpfreaks.com/topic/232894-media-player-and-php-variables/#findComment-1197885 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.