Lux05 Posted August 14, 2011 Share Posted August 14, 2011 HI With my limited PHP knowledges i tried to modify a PHP script to replace the simple MP3 player with the JW Player and luckily i managed to do this but the last task i wanted to do im stuck. The last task i wanted to do was if an Audio file was detected it would use the Audio script for the JW Player to play the file. But i had no luck on doing this so i hop someone with more PHP knowledges can help out here. Working Script Code for all files: // mp3 player if ($file->extern_file){ $extern_mp3 = true; $filetype = strtolower(substr(strrchr($file->extern_file, '.'), 1)); } else { $filetype = strtolower(substr(strrchr($file->url_download, '.'), 1)); $extern_mp3 = false; } if ($filetype == 'mp4' || $filetype == 'mov' || $filetype == 'flv' || $filetype == '3gp' || $filetype == '3g2' || $filetype == 'aac' || $filetype == 'm4a' || $filetype == 'mp3'){ if ($extern_mp3){ $mp3_path = $file->extern_file; } else { $mp3_path = JURI::base().$jlistConfig['files.uploaddir'].'/'.$cat->cat_dir.'/'.$file->url_download; } $mp3_player = '<script type="text/javascript" src="/components/com_jdownloads/jwplayer/jwplayer.js"></script> <div id="container">Loading the media player ...</div> <script type="text/javascript"> jwplayer("container").setup({ flashplayer: "/components/com_jdownloads/jwplayer/player.swf", backcolor: "333333", frontcolor: "FFFFFF", lightcolor: "FF0000", screencolor: "000000", controlbar: "bottom", file: "'.$mp3_path.'", volume: 50, height: 384, width: 480, plugins: "timeslidertooltipplugin-1" }); </script>'; if ($extern_mp3){ $mp3_path_abs = JPATH_BASE.DS.$jlistConfig['files.uploaddir'].DS.$cat->cat_dir.DS.$file->url_download; } $html_file = str_replace('{mp3_player}', $mp3_player, $html_file); } else { $html_file = str_replace('{mp3_player}', '', $html_file); } JW Player code that should be used for the Audio files: <script type="text/javascript" src="/components/com_jdownloads/jwplayer/jwplayer.js"></script> <div id="container">Loading the media player ...</div> <script type="text/javascript"> jwplayer("container").setup({ flashplayer: "/components/com_jdownloads/jwplayer/player.swf", backcolor: "333333", frontcolor: "FFFFFF", lightcolor: "FF0000", screencolor: "000000", controlbar: "bottom", file: "'.$mp3_path.'", volume: 50, height: 24, width: 480, plugins: "timeslidertooltipplugin-1" }); </script> Quote Link to comment https://forums.phpfreaks.com/topic/244718-help-needed-to-modify-a-php-script/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.