nay
Forum Replies Created
-
Forum: Plugins
In reply to: flowplayer pluginThanks for all the feedback guys and sorry I haven’t been keeping an eye on this thread.
There is an error in the code which creates erroneous paths. In the function fp4wp_video you forgot to declare these variables as globals:
global $fp4wp_uploads_path;
global $fp4wp_plugins_path;thanks. fixed below.
NB: the embed tag needs to be updated in both audio and video formats if you want it to work in IE. File src should be same as the object tag.
thanks. fixed below.
1. Where do I actually FTP the flv movie file I’m trying to play within a post? Or should I use the upload button on the “Manage – Post” page?
you can change this line to wherever you want to upload your files:
$fp4wp_uploads_path = ‘/wp-content/uploads/’;2. What does “heart” mean here in this line: <param name=”movie” value=”/heart/flowplayer/FlowPlayer.swf” />
sorry, ‘heart’ was just the local folder i had my install in. I’ll delete it below to save confusion.
3. Where do you specify WHICH specific Flow player you want to use (classic, light, dark etc)?
to change the default skin, you need to specify a different player than ‘FlowPlayer.swf’ – check the flow player documentation for more info.
4. I got this error message when I put [PLAYER=filename] in my post…maybe it’s complaining that I haven’t actually specified a file name?
try specifying a file name once you have it set up correctly.
okay, so here’s the updated code:
/********************************/ <?php /* Plugin Name: fp4wp Plugin URI: https://renechristen.net Description: Embed FlowPlayer in WordPress. Version: 1.1 Author: Rene Christen Author URI: https://renechristen.net */ ?> <?php $fp4wp_uploads_path = '/wp-content/uploads/'; $fp4wp_plugins_path = '/wp-content/plugins/'; add_filter('the_content', 'fp4wp_the_content'); function fp4wp_the_content( $content ) { // AUDIO $search = "/\[PLAYER=(.*\.mp3)\]/"; //.mp3 preg_match_all($search, $content, $audio_matches); if (is_array($audio_matches[1])) { foreach ($audio_matches[1] as $filename) { $search = "[PLAYER=".$filename."]"; $replace = fp4wp_audio($filename); $content = str_replace ($search, $replace, $content); } } // VIDEO $search = "/\[PLAYER=(.*)\]/"; //.mp4,.m4v,.m4a,.mov,.3gp,.flv etc... preg_match_all($search, $content, $video_matches); if (is_array($video_matches[1])) { foreach ($video_matches[1] as $filename) { $search = "[PLAYER=".$filename."]"; $replace = fp4wp_video($filename); $content = str_replace ($search, $replace, $content); } } return $content; } function fp4wp_audio($filename) { //.mp3 global $fp4wp_uploads_path; global $fp4wp_plugins_path; $string = '<object type="application/x-shockwave-flash" data="' . $fp4wp_plugins_path . 'fp4wp/flowplayer/FlowPlayer.swf" width="320" height="22" id="FlowPlayer"><param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="' . $fp4wp_plugins_path . 'fp4wp/flowplayer/FlowPlayer.swf" /> <param name="quality" value="high" /> <param name="scale" value="noScale" /> <param name="wmode" value="transparent" /> <param name="flashvars" value="config={playList:[{ url: \'' . $fp4wp_uploads_path . $filename . '\', },], showPlayListButtons: false, loop: false, autoPlay: false, hideControls: false, showFullScreenButton: false, showMenu: false, showLoopButton: false, initialScale: \'orig\', autoBuffering: false }); fo.write(\'fp1\');}" /></object>'; return $string; } function fp4wp_video($filename) { //.mp4,.m4v,.m4a,.mov,.3gp,.flv etc... global $fp4wp_uploads_path; global $fp4wp_plugins_path; $string = '<object type="application/x-shockwave-flash" data="' . $fp4wp_plugins_path . 'fp4wp/flowplayer/FlowPlayer.swf" width="320" height="262" id="FlowPlayer"><param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="' . $fp4wp_plugins_path . 'fp4wp/flowplayer/FlowPlayer.swf" /> <param name="quality" value="high" /> <param name="scale" value="noScale" /> <param name="wmode" value="transparent" /> <param name="flashvars" value="config={videoFile: \'' . $fp4wp_uploads_path . $filename . '\'}, showPlayListButtons: true, loop: false, autoPlay: false, hideControls: false, showFullScreenButton: true, showMenu: false, showLoopButton: false, initialScale: \'orig\', autoBuffering: false }); fo.write(\'fp1\');}" /></object>'; return $string; } ?>