DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:flowplay2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:flowplay2 [2009-10-26 13:14] – two renders 193.146.94.130plugin:flowplay2 [2023-12-21 15:35] (current) – new download url Aleksandr
Line 1: Line 1:
-====== flowplay2 plugin ======+====== flowplay2 Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Integrates the flowplayer to stream video to an embedded flash applet (like on YouTube) probably better that the original flowplay plugin does.+description: Integrates the flowplayer to stream video to an embedded flash applet (like on YouTube) probably better that the original flowplay plugin does
 author     : bspot author     : bspot
 email      : blind (at) bspot.de email      : blind (at) bspot.de
 type       : syntax type       : syntax
 lastupdate : 2008-04-16 lastupdate : 2008-04-16
-compatible : ???+compatible : 2008-05-05
 depends    :  depends    : 
 conflicts  : flowplay conflicts  : flowplay
-similar    : youtube, youtubev2, google_video, flashplayer, video, flowplay +similar    : flashplayer, flowplay, video, youtube 
-tags       : media, video, flash, embed, !experimental+tags       : !obsolete, media, video, flash, embed, !experimental 
 + 
 +downloadurl: https://trello.com/1/cards/5b05a1106591ba87e1f492c1/attachments/5b05a12431803287e8807a4c/download/flowplay2-0.3.zip 
 +bugtracker :  
 +sourcerepo :  
 +donationurl:  
 + 
 +screenshot_img: 
 ---- ----
  
-^  Author | bspot <blind (at) bspot.de>| +Flash is not available anymore in browsersVideo functionality is included in DokuWikisee the [[wiki:syntax#media_files|media syntax description]] and [[:video]] options included adding subtitles.
-^  Version | 0.3 (2008-04-16)bundled with FlowPlayer 2.1.2 | +
-^  Status | [[:experimental]] | +
-^  Required DokuWiki version | tested with some of these 2008-04 releases | +
-^  Download | [[http://www.bspot.de/lib/exe/fetch.php?id=flowplay2%3Astart&cache=cache&media=flowplay2:flowplay2-0.3.zip|flowplay2-0.3.zip]][[http://www.bspot.de/lib/exe/fetch.php?id=flowplay2%3Astart&cache=cache&media=flowplay2:flowplay2-0.3.tar.gz|flowplay2-0.3.tar.gz]] +
-^  Old revisions | none |+
  
 ===== Description ===== ===== Description =====
Line 25: Line 27:
 Using this plugin, you can embed audio and video files into your wiki pages. Anyone with a reasonably recent Flash Player will <del>have to</del> be able to watch your videos and listen to your songs right in their browser. Using this plugin, you can embed audio and video files into your wiki pages. Anyone with a reasonably recent Flash Player will <del>have to</del> be able to watch your videos and listen to your songs right in their browser.
  
-This is accomplished by embedding [[http://flowplayer.org/|flowplayer]].+This is accomplished by embedding [[https://flowplayer.com/|Flowplayer]].
  
 In contrast to the original [[:plugin:flowplay|flowplay-plugin]], flowplay2 allows to use one player instance for many video/audio files on the same page. Further, it allows for more sophisticated configuration of the flowplayer. In contrast to the original [[:plugin:flowplay|flowplay-plugin]], flowplay2 allows to use one player instance for many video/audio files on the same page. Further, it allows for more sophisticated configuration of the flowplayer.
Line 40: Line 42:
 > >
 >Half of the plugin code was copied from the [[video]] plugin by Jason Byrne and Chris Smith (I just needed a template, and that code was similar enough to mine)" >Half of the plugin code was copied from the [[video]] plugin by Jason Byrne and Chris Smith (I just needed a template, and that code was similar enough to mine)"
- 
-===== Installation ===== 
- 
-Paste one of these into your plugin manager: [[http://www.bspot.de/lib/exe/fetch.php?id=flowplay2%3Astart&cache=cache&media=flowplay2:flowplay2-0.3.zip|flowplay2-0.3.zip]], [[http://www.bspot.de/lib/exe/fetch.php?id=flowplay2%3Astart&cache=cache&media=flowplay2:flowplay2-0.3.tar.gz|flowplay2-0.3.tar.gz]] 
  
 ===== Configuration ===== ===== Configuration =====
Line 57: Line 55:
 Works like for the flowplay plugin. Citing Dave Kliczbor again: Works like for the flowplay plugin. Citing Dave Kliczbor again:
  
->In most cases, no additional configuration is needed. There are some rare cases when the video does not play... I haven't completely sorted it out, but you seem to get a better chance if you let the browser load the .swf file over HTTP. Then again, you may want to use another FlowPlayer installation on your server. +> In most cases, no additional configuration is needed. There are some rare cases when the video does not play... I haven't completely sorted it out, but you seem to get a better chance if you let the browser load the .swf file over HTTP. Then again, you may want to use another FlowPlayer installation on your server. 
-+>  
->In both cases, you have one configuration variable to set: <code>+> In both cases, you have one configuration variable to set: <code>
 $conf['plugin']['flowplay']['player_base_url'] = 'http://yourserver.tld/flowplayer-0.14/'; $conf['plugin']['flowplay']['player_base_url'] = 'http://yourserver.tld/flowplayer-0.14/';
 </code> </code>
->This example assumes that the URL of ''FlowPlayer.swf'' is: ''%%http://yourserver.tld/flowplayer-0.14/FlowPlayer.swf%%''+> This example assumes that the URL of ''FlowPlayer.swf'' is: ''%%http://yourserver.tld/flowplayer-0.14/FlowPlayer.swf%%''
  
 ===== Usage ===== ===== Usage =====
Line 70: Line 68:
   * image: JPG, PNG   * image: JPG, PNG
   * audio: MP3   * audio: MP3
-Check [[http://flowplayer.org]] for updates.+Check [[https://flowplayer.com/]] for updates.
  
 About the conversion take a look at [[http://flowplayer.sourceforge.net/encoding.html]] or the [[:plugin:flowplay|flowplay plugin]] page. About the conversion take a look at [[http://flowplayer.sourceforge.net/encoding.html]] or the [[:plugin:flowplay|flowplay plugin]] page.
Line 77: Line 75:
   * have to embed the player, and   * have to embed the player, and
   * optionally may define further files to be shown in the player.   * optionally may define further files to be shown in the player.
 +
 ==== Embedding the player ==== ==== Embedding the player ====
  
 Syntax: Syntax:
  
-<code> +  {{flowplay>_path_to_media_file_?_player_options_}}
-{{flowplay>_path_to_media_file_?_player_options_}} +
-</code>+
  
-The _path_to_media_file_ is - you may have guessed - a path to any media file recognized by the player. It is though optional: If you leave it out, the player won't be shown (and loaded) until one of the playlist items (see below) is clicked. +The ''_path_to_media_file_'' is -- you may have guessed -- a path to any media file recognized by the player. It is though optional: If you leave it out, the player won't be shown (and loaded) until one of the playlist items (see below) is clicked.
  
-The _player_options_ is a list of space-separated options passed to the flowplayer as follows:+The ''_player_options_'' is a list of space-separated options passed to the flowplayer as follows:
   * An option looking like ''widthxheight'' sets the width and height of the player.   * An option looking like ''widthxheight'' sets the width and height of the player.
   * An option looking like ''option:value'' sets any non-boolean ''option'' to ''value''.   * An option looking like ''option:value'' sets any non-boolean ''option'' to ''value''.
Line 100: Line 97:
 The syntax is: The syntax is:
  
-<code> +  [[flowplay>_path_to_media_file_|_link_title_]]
-[[flowplay>_path_to_media_file_|_link_title_]] +
-</code>+
  
-The _path_to_media_file_ again is the path to your media file. It is of course not optional here. +  * The ''_path_to_media_file_'' again is the path to your media file. It is of course not optional here. 
- +  The ''_link_title_'' the title of the link -- any wiki markup allowed.
-The _link_title_ the title of the link - any wiki markup allowed.+
  
 ===== Known Bugs ===== ===== Known Bugs =====
Line 116: Line 110:
  
   * **2008-04-16 Version 0.3**:   * **2008-04-16 Version 0.3**:
-            * Initial release. This has number 0.3 because it is based on flowplay 0.2+    * Initial release. This has number 0.3 because it is based on flowplay 0.2 
 ===== Discussion ===== ===== Discussion =====
  
Line 147: Line 142:
  
 I have had some problems showing two renders of the plugin. I modified the source. Not very clean but good enough. I have had some problems showing two renders of the plugin. I modified the source. Not very clean but good enough.
-  $ LANG=C diff -uNr syntax.php ~/dokuwiki/lib/plugins/flowplay2/syntax.php + 
-  --- syntax.php 2009-02-13 10:59:30.000000000 +0000 +<code diff> 
-  +++ /home/eduardo/dokuwiki/lib/plugins/flowplay2/syntax.php 2009-10-26 11:41:25.000000000 +0000 +$ LANG=C diff -uNr syntax.php ~/dokuwiki/lib/plugins/flowplay2/syntax.php 
-  @@ -179,6 +179,10 @@ +--- syntax.php 2009-02-13 10:59:30.000000000 +0000 
-   $r .= "videoFile: '" . ml($indata["url"]) . "'"; ++++ /home/eduardo/dokuwiki/lib/plugins/flowplay2/syntax.php 2009-10-26 11:41:25.000000000 +0000 
-     +@@ -179,6 +179,10 @@ 
-    $r .= "  " . DOKU_LF; +        $r .= "videoFile: '" . ml($indata["url"]) . "'";
-  + +
-  + // Eduardo +
-  + preg_match("/:(\w+)\./",$indata["url"],$url_id); +
-  + //$r .=   "\\\\ " . $url_id[1] . DOKU_LF; +
-     +
-    // EMBED configuration +
-    $r .= "var embedConfig =   " . DOKU_LF . +
-  @@ -191,10 +195,14 @@ +
-    "</script>" . DOKU_LF; +
-     +
-    // add the player-div +
-  - $r .= "<div id='flowplayer'></div>"; +
-  + //$r .= "<div id='flowplayer'></div>"; +
-  + // Eduardo +
-  + $r .= "<div id='flowplayer_" . $url_id[1] . "' class='flowplayitem'></div>"; +
-  + +
-  + $r .= '<script language="javascript">runFlowPlayer(playerConfig["videoFile"]);</script>'; +
-     +
-    return $r; +
-    } +
-   }+
          
-  -?> +    $r .= "  " . DOKU_LF; 
-  \ No newline at end of file +
-  +?>++ // Eduardo 
 ++ preg_match("/:(\w+)\./",$indata["url"],$url_id); 
 ++ //$r .=   "\\\\ " . $url_id[1] . DOKU_LF; 
 +         
 +    // EMBED configuration 
 +    $r .= "var embedConfig =   " . DOKU_LF . 
 +@@ -191,10 +195,14 @@ 
 +        "</script>" . DOKU_LF; 
 +     
 +    // add the player-div 
 +- $r .= "<div id='flowplayer'></div>"; 
 ++ //$r .= "<div id='flowplayer'></div>"; 
 ++ // Eduardo 
 ++ $r .= "<div id='flowplayer_" . $url_id[1] . "' class='flowplayitem'></div>"; 
 +
 ++ $r .= '<script language="javascript">runFlowPlayer(playerConfig["videoFile"]);</script>'; 
 +     
 +    return $r; 
 +
 +
 + 
 +-?> 
 +\ No newline at end of file 
 ++?
 +</code>
  
 and also and also
  
-  $ LANG=C diff -uNr playlist.js ~/dokuwiki/lib/plugins/flowplay2/playlist.js +<code diff> 
-  --- playlist.js 2008-04-16 22:17:52.000000000 +0100 +$ LANG=C diff -uNr playlist.js ~/dokuwiki/lib/plugins/flowplay2/playlist.js 
-  +++ /home/eduardo/dokuwiki/lib/plugins/flowplay2/playlist.js 2009-10-26 11:41:47.000000000 +0000 +--- playlist.js 2008-04-16 22:17:52.000000000 +0100 
-  @@ -31,6 +31,9 @@ ++++ /home/eduardo/dokuwiki/lib/plugins/flowplay2/playlist.js 2009-10-26 11:41:47.000000000 +0000 
-   {  +@@ -31,6 +31,9 @@ 
-   // set URL +{  
-   playerConfig.videoFile = url;  +// set URL 
-  +playerConfig.videoFile = url;  
-  + // Eduardo +
-  + var id_url = url.match(/:(\w+)\./); ++ // Eduardo 
-    ++ var id_url = url.match(/:(\w+)\./); 
-   // if flowplayer is not loaded. load it now.  + 
-   if (flowplayerobject == null)  +// if flowplayer is not loaded. load it now.  
-  @@ -39,7 +42,8 @@ +if (flowplayerobject == null)  
-   // Flash API is automatically returned (flashembed.js ver. 0.27)  +@@ -39,7 +42,8 @@ 
-   flowplayerobject = flashembed +    // Flash API is automatically returned (flashembed.js ver. 0.27)  
-   +    flowplayerobject = flashembed 
-  - "flowplayer", +    
-  + "flowplayer_" + id_url[1], +- "flowplayer", 
-  + //"flowplayer", ++ "flowplayer_" + id_url[1], 
-   embedConfig, ++ //"flowplayer", 
-   {config: playerConfig}  +        embedConfig, 
-   ); +        {config: playerConfig}  
-  @@ -53,27 +57,29 @@ +    ); 
-   +@@ -53,27 +57,29 @@ 
-    +
-    + 
-  + 
-   window.onload = function()  +
-   {  +window.onload = function()  
-  - var links = document.getElementsByTagName("a");   +{  
-  - for (var i = 0; i < links.length; i++)  +- var links = document.getElementsByTagName("a");   
-  - { +- for (var i = 0; i < links.length; i++)  
-  - if (links[i].className == "flowplayitem")  +- { 
-  - { +- if (links[i].className == "flowplayitem")  
-  - links[i].onclick = function()  +- { 
-  - {   +- links[i].onclick = function()  
-  - playerConfig.autoPlay = true; +- {   
-  - runFlowPlayer(this.getAttribute("href")); +- playerConfig.autoPlay = true; 
-  -  +- runFlowPlayer(this.getAttribute("href")); 
-  - // disable link's default behaviour  +-  
-  - return false;   +- // disable link's default behaviour  
-  - } +- return false;   
-  - } +- } 
-  - }  +- } 
-  -  +- }  
-  - // start player if url is given +-  
-  - if (playerConfig["videoFile"]) +- // start player if url is given 
-  - runFlowPlayer(playerConfig["videoFile"]); +- if (playerConfig["videoFile"]) 
-  +- runFlowPlayer(playerConfig["videoFile"]); 
-  + //var links = document.getElementsByTagName("a");   +
-  + //for (var i = 0; i < links.length; i++)  ++ //var links = document.getElementsByTagName("a");   
-  + //{ ++ //for (var i = 0; i < links.length; i++)  
-  + // if (links[i].className == "flowplayitem")  ++ //{ 
-  + // { ++ // if (links[i].className == "flowplayitem")  
-  + // links[i].onclick = function()  ++ // { 
-  + //  ++ // links[i].onclick = function()  
-  + // playerConfig.autoPlay = true; ++ //  
-  + // runFlowPlayer(this.getAttribute("href")); ++ // playerConfig.autoPlay = true; 
-  + //  ++ // runFlowPlayer(this.getAttribute("href")); 
-  + // // disable link's default behaviour  ++ //  
-  + // return false;   ++ // // disable link's default behaviour  
-  + // } ++ // return false;   
-  + // } ++ // } 
-  + //}  ++ // } 
-  + //  ++ //}  
-  + //// start player if url is given ++ //  
-  + //if (playerConfig["videoFile"]) ++ //// start player if url is given 
-  + // runFlowPlayer(playerConfig["videoFile"]); ++ //if (playerConfig["videoFile"]) 
-    ++ // runFlowPlayer(playerConfig["videoFile"]); 
-   // when user presses splash image it triggers our first playlist entry  + 
-   if (document.getElementById("splash"))+// when user presses splash image it triggers our first playlist entry  
 +if (document.getElementById("splash")) 
 +</code> 
 + 
 +===== Putting more than one player on a page ===== 
 + 
 +<code php syntax.php> 
 +<?php 
 +/** 
 + * flowplay2: embeds a video stream player flash applet into your page 
 + * 
 + * This is mostly based on the flowplay-plugin by Dave Kliczbor et al. 
 + * 
 + * Syntax: 
 +   Please look at the README 
 + * 
 + * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) 
 + * @version    0.3 
 + * @author     bSpot <blind@bspot.de> 
 + */ 
 +  
 +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 
 +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
 +define('PLUGIN_FLOW', DOKU_BASE.'lib/plugins/flowplay2/flowplayer/'); 
 +require_once(DOKU_PLUGIN.'syntax.php'); 
 +  
 +if (!function_exists('hsc'))  
 +
 + function hsc($string){ return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
 +
 +  
 +class syntax_plugin_flowplay2 extends DokuWiki_Syntax_Plugin  
 +
 +  
 + function getInfo() 
 +
 + return array ( 
 + 'author' => 'bSpot', 
 + 'email'  => 'blind@bspot.de', 
 + 'date'   => '2008-04-16', 
 + 'version'=> '0.3', 
 + 'name'   => 'flowplay2', 
 + 'desc'   => 'Embeds a video stream player flash applet into your page', 
 + 'url'    => 'http://wiki.splitbrain.org/plugin:flowplay2', 
 + 'ack'    => 'This is mostly based on the flowplay-plugin by Dave Kliczbor et al.', 
 + ); 
 +
 + 
 + function getType() { return 'protected';
 + function getAllowedTypes() { return array('container','substition','protected','disabled','formatting','paragraphs');
 + function getPType() { return 'normal';
 + 
 +  
 + function getSort() 
 +
 + return 191; 
 +
 +  
 + function connectTo($mode)  
 + {  
 + // pattern for the flashplayer 
 + $this->Lexer->addSpecialPattern('{{flowplay>.*?}}', $mode, 'plugin_flowplay2'); 
 + // entry pattern for playlist-items 
 + $this->Lexer->addEntryPattern('\[\[flowplay>[^|]*\|',$mode,'plugin_flowplay2'); 
 +
 +  
 + function postConnect() 
 +
 + // exit pattern for playlist-items 
 + $this->Lexer->addExitPattern('\]\]','plugin_flowplay2');  
 +
 +  
 + function handle($match,$state,$pos,&$handler) 
 +
 + $m = array(); 
 + 
 + switch ($state)  
 +
 + // player 
 + case DOKU_LEXER_SPECIAL: 
 + list($url, $paramStr) = explode('?', substr($match, strlen('{{flowplay>'), -2), 2); 
 + // prepare parameter list 
 + foreach (explode(" ", $paramStr) as $param) 
 +
 + // width/height parameter 
 + if ( preg_match('/(\d+)x(\d+)/', $param, $m) ) 
 +
 + $params['width'] = $m[1]; 
 + $params['height'] = $m[2]; 
 +
 + // non-boolean parameter 
 + else if ( preg_match('/([^:]+):(.*)$/', $param, $m) ) 
 + $params[$m[1]] = $m[2]; 
 + // boolean parameter set to false 
 + else if (substr($param, 0, 2) == "no"
 + $params[strtolower(substr($param, 2, 1)) . substr($param, 3)] = False; 
 + // boolean parameter set to true 
 + else 
 + $params[$param] = True; 
 +
 +  
 + return array('type' => 'player', 'url' => $url, 'paramStr' => $paramStr, 'params' => $params); 
 +  
 + // playlist 
 + case DOKU_LEXER_ENTER: 
 + $url = substr($match, strlen('[[flowplay>'), -1); 
 + return array('type' => 'playlist_open', 'url' => $url); 
 + 
 + case DOKU_LEXER_MATCHED: 
 + return array('type' => 'data', 'match' => $match); 
 + 
 + case DOKU_LEXER_UNMATCHED: 
 + return array('type' => 'data', 'match' => $match); 
 + 
 + case DOKU_LEXER_EXIT: 
 + return array('type' => 'playlist_close', 'match' => $match); 
 +        } 
 + return false; 
 +
 + 
 + function render($mode, &$renderer, $indata)  
 +
 + if($mode == 'xhtml'
 +
 + switch ($indata['type'])  
 +
 + // player 
 + case 'player' :    
 + /* 
 + // DISABLED DEBUG OUTPUT 
 + $renderer->doc .= "<ul>"; 
 + $renderer->doc .= "<b>url => " . $indata['url'] . " (" . ml($indata['url']) . ")</b>"; 
 + foreach ($indata['params'] as $k => $v) 
 + $renderer->doc .= "<li>" . $k . " => " . $v. "</li>"; 
 + $renderer->doc .= "</ul>";*/ 
 + $renderer->doc .= $this->_renderPlayer($indata, preg_match_all('/id\=\'flowplayer/',$renderer->doc,$dummy ) ); 
 + break; 
 +  
 + // playlist 
 + case 'playlist_open'
 + $renderer->doc .= "<a href='" . ml($indata["url"]) . "' class='flowplayitem'>"; 
 + break; 
 +  
 + case 'data': 
 + $renderer->doc .= $renderer->_xmlEntities($indata['match']);  
 + break; 
 +  
 + case 'playlist_close' :  
 + $renderer->doc .= "</a>"; 
 + break; 
 +
 +  
 + return true; 
 +
 + return false; 
 +
 +  
 + function _renderPlayer($indata, $oc) 
 +
 + // determine player url 
 + if( strlen($this->getConf('player_base_url')) > 0 )  
 + $prefix = $this->getConf('player_base_url'); 
 + else  
 + $prefix = PLUGIN_FLOW; 
 + if( $prefix{strlen($prefix)-1} !== '/' ) $prefix .= '/';  
 +  
 + $params = $indata["params"]; 
 +  
 + // embed javascript 
 +                $r = ""; 
 +                if ($oc < 1){ //this is the first one 
 + $r .= '<script language="javascript" src="' . $prefix . 'html/flashembed.min.js"></script>'; 
 + $r .= '<script language="javascript" src="' . $prefix . '../playlist.js"></script>'; 
 +                $oc=''; 
 +                } 
 + // player configuration 
 + $r .= "<script language='javascript'>" . DOKU_LF . 
 + "var playerConfig$oc = " . DOKU_LF . 
 + "  " . DOKU_LF . 
 + " controlBarBackgroundColor: '0x99cddc',   " . DOKU_LF; 
 +  
 + // add params 
 + foreach ($indata['params'] as $k => $v) 
 + $r .= $k . ": " . ($v === True ? "true" : ($v === False ? "false" : "'" . $v . "'")) . ",";  
 +  
 + // run player on startup if a url is given 
 + if ($indata["url"] != ""
 + $r .= "videoFile: '" . ml($indata["url"]) . "'"; 
 +  
 + $r .= "  " . DOKU_LF; 
 +  
 + // EMBED configuration 
 + $r .= "var embedConfig$oc =   " . DOKU_LF . 
 + "  " . DOKU_LF . 
 + ($params["width"] ? "width: " . $params["width"] . ",   " . DOKU_LF : "") .  
 + ($params["height"] ? "height: " . $params["height"] . ",   " . DOKU_LF : "") .  
 + " src:'" . $prefix . $this->getConf('player_swf') . "',   " . DOKU_LF . 
 + " bgcolor:'#6F7485'   " . DOKU_LF . 
 + "  " . DOKU_LF .  
 + "</script>" . DOKU_LF; 
 +  
 + // add the player-div 
 + $r .= "<div id='flowplayer$oc'></div>"; 
 + if ($oc != '') $r .="<script language='javascript'> flashembed('flowplayer$oc', embedConfig$oc, {config: playerConfig$oc}); </script>"; 
 + return $r; 
 +
 +
 +  
 +?> 
 +</code>
  
plugin/flowplay2.1256559244.txt.gz · Last modified: 2009-10-26 13:14 by 193.146.94.130

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki