plugin:flowplay2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:flowplay2 [2009-10-10 23:37] – adjusted status tag ach | plugin:flowplay2 [2023-12-21 15:35] (current) – new download url Aleksandr | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== flowplay2 | + | ====== flowplay2 |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
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 | conflicts | ||
- | similar | + | similar |
- | tags : media, video, flash, embed, !experimental | + | tags : |
+ | |||
+ | downloadurl: | ||
+ | bugtracker : | ||
+ | sourcerepo : | ||
+ | donationurl: | ||
+ | |||
+ | screenshot_img: | ||
---- | ---- | ||
- | ^ Author | bspot <blind (at) bspot.de>| | + | Flash is not available anymore in browsers. Video functionality is included in DokuWiki, see the [[wiki:syntax# |
- | ^ 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:// | + | |
- | ^ 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 < | Using this plugin, you can embed audio and video files into your wiki pages. Anyone with a reasonably recent Flash Player will < | ||
- | This is accomplished by embedding [[http:// | + | This is accomplished by embedding [[https:// |
In contrast to the original [[: | In contrast to the original [[: | ||
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:// | ||
===== 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' | + | > In most cases, no additional configuration is needed. There are some rare cases when the video does not play... I haven' |
- | > | + | > |
- | >In both cases, you have one configuration variable to set: < | + | > In both cases, you have one configuration variable to set: < |
$conf[' | $conf[' | ||
</ | </ | ||
- | >This example assumes that the URL of '' | + | > This example assumes that the URL of '' |
===== Usage ===== | ===== Usage ===== | ||
Line 70: | Line 68: | ||
* image: JPG, PNG | * image: JPG, PNG | ||
* audio: MP3 | * audio: MP3 | ||
- | Check [[http:// | + | Check [[https:// |
About the conversion take a look at [[http:// | About the conversion take a look at [[http:// | ||
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: | ||
- | < | + | |
- | {{flowplay> | + | |
- | </ | + | |
- | 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 '' |
- | The _player_options_ is a list of space-separated options passed to the flowplayer as follows: | + | The '' |
* An option looking like '' | * An option looking like '' | ||
* An option looking like '' | * An option looking like '' | ||
Line 100: | Line 97: | ||
The syntax is: | The syntax is: | ||
- | < | + | |
- | [[flowplay> | + | |
- | </ | + | |
- | + | ||
- | 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 '' |
+ | * The '' | ||
===== Known Bugs ===== | ===== Known Bugs ===== | ||
Line 116: | Line 110: | ||
* **2008-04-16 Version 0.3**: | * **2008-04-16 Version 0.3**: | ||
- | | + | |
===== Discussion ===== | ===== Discussion ===== | ||
Line 143: | Line 138: | ||
* code: 0 | * code: 0 | ||
I tried this with IE version 6 up to version 8. | I tried this with IE version 6 up to version 8. | ||
+ | |||
+ | === Problems with two renders === | ||
+ | |||
+ | I have had some problems showing two renders of the plugin. I modified the source. Not very clean but good enough. | ||
+ | |||
+ | <code diff> | ||
+ | $ LANG=C diff -uNr syntax.php ~/ | ||
+ | --- syntax.php 2009-02-13 10: | ||
+ | +++ / | ||
+ | @@ -179,6 +179,10 @@ | ||
+ | $r .= " | ||
+ | | ||
+ | $r .= " | ||
+ | + | ||
+ | + // Eduardo | ||
+ | + preg_match("/: | ||
+ | + //$r .= " | ||
+ | | ||
+ | // EMBED configuration | ||
+ | $r .= "var embedConfig = " | ||
+ | @@ -191,10 +195,14 @@ | ||
+ | "</ | ||
+ | | ||
+ | // add the player-div | ||
+ | - $r .= "< | ||
+ | + //$r .= "< | ||
+ | + // Eduardo | ||
+ | + $r .= "< | ||
+ | + | ||
+ | + $r .= '< | ||
+ | | ||
+ | return $r; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | -?> | ||
+ | \ No newline at end of file | ||
+ | +?> | ||
+ | </ | ||
+ | |||
+ | and also | ||
+ | |||
+ | <code diff> | ||
+ | $ LANG=C diff -uNr playlist.js ~/ | ||
+ | --- playlist.js 2008-04-16 22: | ||
+ | +++ / | ||
+ | @@ -31,6 +31,9 @@ | ||
+ | { | ||
+ | // set URL | ||
+ | playerConfig.videoFile = url; | ||
+ | + | ||
+ | + // Eduardo | ||
+ | + var id_url = url.match(/: | ||
+ | |||
+ | // if flowplayer is not loaded. load it now. | ||
+ | if (flowplayerobject == null) | ||
+ | @@ -39,7 +42,8 @@ | ||
+ | // Flash API is automatically returned (flashembed.js ver. 0.27) | ||
+ | flowplayerobject = flashembed | ||
+ | ( | ||
+ | - " | ||
+ | + " | ||
+ | + //" | ||
+ | embedConfig, | ||
+ | {config: playerConfig} | ||
+ | ); | ||
+ | @@ -53,27 +57,29 @@ | ||
+ | } | ||
+ | |||
+ | |||
+ | + | ||
+ | window.onload = function() | ||
+ | { | ||
+ | - var links = document.getElementsByTagName(" | ||
+ | - for (var i = 0; i < links.length; | ||
+ | - { | ||
+ | - if (links[i].className == " | ||
+ | - { | ||
+ | - links[i].onclick = function() | ||
+ | - { | ||
+ | - playerConfig.autoPlay = true; | ||
+ | - runFlowPlayer(this.getAttribute(" | ||
+ | - | ||
+ | - // disable link's default behaviour | ||
+ | - return false; | ||
+ | - } | ||
+ | - } | ||
+ | - } | ||
+ | - | ||
+ | - // start player if url is given | ||
+ | - if (playerConfig[" | ||
+ | - runFlowPlayer(playerConfig[" | ||
+ | + | ||
+ | + //var links = document.getElementsByTagName(" | ||
+ | + //for (var i = 0; i < links.length; | ||
+ | + //{ | ||
+ | + // if (links[i].className == " | ||
+ | + // { | ||
+ | + // | ||
+ | + // | ||
+ | + // | ||
+ | + // | ||
+ | + // | ||
+ | + // // disable link's default behaviour | ||
+ | + // | ||
+ | + // } | ||
+ | + // } | ||
+ | + //} | ||
+ | + // | ||
+ | + //// start player if url is given | ||
+ | + //if (playerConfig[" | ||
+ | + // | ||
+ | |||
+ | // when user presses splash image it triggers our first playlist entry | ||
+ | if (document.getElementById(" | ||
+ | </ | ||
+ | |||
+ | ===== 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: | ||
+ | | ||
+ | * | ||
+ | * @license | ||
+ | * @version | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | if(!defined(' | ||
+ | if(!defined(' | ||
+ | define(' | ||
+ | require_once(DOKU_PLUGIN.' | ||
+ | |||
+ | if (!function_exists(' | ||
+ | { | ||
+ | function hsc($string){ return htmlspecialchars($string, | ||
+ | } | ||
+ | |||
+ | class syntax_plugin_flowplay2 extends DokuWiki_Syntax_Plugin | ||
+ | { | ||
+ | |||
+ | function getInfo() | ||
+ | { | ||
+ | return array ( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | function getType() { return ' | ||
+ | function getAllowedTypes() { return array(' | ||
+ | function getPType() { return ' | ||
+ | |||
+ | |||
+ | function getSort() | ||
+ | { | ||
+ | return 191; | ||
+ | } | ||
+ | |||
+ | function connectTo($mode) | ||
+ | { | ||
+ | // pattern for the flashplayer | ||
+ | $this-> | ||
+ | // entry pattern for playlist-items | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | function postConnect() | ||
+ | { | ||
+ | // exit pattern for playlist-items | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | function handle($match, | ||
+ | { | ||
+ | $m = array(); | ||
+ | |||
+ | switch ($state) | ||
+ | { | ||
+ | // player | ||
+ | case DOKU_LEXER_SPECIAL: | ||
+ | list($url, | ||
+ | // prepare parameter list | ||
+ | foreach (explode(" | ||
+ | { | ||
+ | // width/ | ||
+ | if ( preg_match('/ | ||
+ | { | ||
+ | $params[' | ||
+ | $params[' | ||
+ | } | ||
+ | // non-boolean parameter | ||
+ | else if ( preg_match('/ | ||
+ | $params[$m[1]] = $m[2]; | ||
+ | // boolean parameter set to false | ||
+ | else if (substr($param, | ||
+ | $params[strtolower(substr($param, | ||
+ | // boolean parameter set to true | ||
+ | else | ||
+ | $params[$param] = True; | ||
+ | } | ||
+ | |||
+ | return array(' | ||
+ | |||
+ | // playlist | ||
+ | case DOKU_LEXER_ENTER: | ||
+ | $url = substr($match, | ||
+ | return array(' | ||
+ | |||
+ | case DOKU_LEXER_MATCHED: | ||
+ | return array(' | ||
+ | |||
+ | case DOKU_LEXER_UNMATCHED: | ||
+ | return array(' | ||
+ | |||
+ | case DOKU_LEXER_EXIT: | ||
+ | return array(' | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function render($mode, | ||
+ | { | ||
+ | if($mode == ' | ||
+ | { | ||
+ | switch ($indata[' | ||
+ | { | ||
+ | // player | ||
+ | case ' | ||
+ | /* | ||
+ | // DISABLED DEBUG OUTPUT | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | foreach ($indata[' | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | break; | ||
+ | |||
+ | // playlist | ||
+ | case ' | ||
+ | $renderer-> | ||
+ | break; | ||
+ | |||
+ | case ' | ||
+ | $renderer-> | ||
+ | break; | ||
+ | |||
+ | case ' | ||
+ | $renderer-> | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function _renderPlayer($indata, | ||
+ | { | ||
+ | // determine player url | ||
+ | if( strlen($this-> | ||
+ | $prefix = $this-> | ||
+ | else | ||
+ | $prefix = PLUGIN_FLOW; | ||
+ | if( $prefix{strlen($prefix)-1} !== '/' | ||
+ | |||
+ | $params = $indata[" | ||
+ | |||
+ | // embed javascript | ||
+ | $r = ""; | ||
+ | if ($oc < 1){ //this is the first one | ||
+ | $r .= '< | ||
+ | $r .= '< | ||
+ | $oc=''; | ||
+ | } | ||
+ | // player configuration | ||
+ | $r .= "< | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | // add params | ||
+ | foreach ($indata[' | ||
+ | $r .= $k . ": " . ($v === True ? " | ||
+ | |||
+ | // run player on startup if a url is given | ||
+ | if ($indata[" | ||
+ | $r .= " | ||
+ | |||
+ | $r .= " | ||
+ | |||
+ | // EMBED configuration | ||
+ | $r .= "var embedConfig$oc = " | ||
+ | " | ||
+ | ($params[" | ||
+ | ($params[" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | "</ | ||
+ | |||
+ | // add the player-div | ||
+ | $r .= "< | ||
+ | if ($oc != '' | ||
+ | return $r; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ?> | ||
+ | </ | ||
+ |
plugin/flowplay2.1255210652.txt.gz · Last modified: 2009-10-10 23:37 by ach