DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:jplayer

jplayer Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" yes
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes

plugin Plugin allows embedding jplayer playlists on your wiki pages

Last updated on
2020-11-10
Provides
Syntax
Repository
Source

Similar to mp3play

Tagged with embed, media, music, namespace

Plugin allows embed jplayer playlists on your wiki pages. mp3 and ogg files are currently supported.

Examples/Usage

Add the playlist with a single file:

{{jPlayerPlaylist>music_file.mp3}}

Add the playlist with several files:

{{jPlayerPlaylist>music_file1.mp3 music_file2.mp3 music_file3.mp3}}

You can use any white spaces as separators:

{{jPlayerPlaylist>music_file1.mp3
                  music_file2.mp3
                  music_file3.mp3}}

Instead of filenames, you can use namespaces

{{jPlayerPlaylist>my_music}}

Or combine any number of files and namespaces:

{{jPlayerPlaylist>my_music music_file1.mp3 some:other:music and:here:some:music_file.mp3}}

Syntax

{{jPlayerPlaylist>white spaces separated list of music files and namespaces}}

Development

Change Log

Releases

Discussion

https://github.com/solewniczak/dokuwiki-plugin-jplayer/issues

It works perfectly on Release 2016-06-26b “Elenor of Tsort”. - Still, What solution do we have to display the real audio file name, not just the local url name, with lowercase and underscores? — Florin 19 November 2017

The plugin displays the ID3 tags of your audio files. Tag your files and you'll have beautiful song titles in your playlist. — Laynee 2018-01-29

Beware

I use this nice plugin on 2 Kaos DokuWiki instances installed on Ubuntu 24.04/20.04 Server with Php 8.2 and it works well.

However when running the php-cli program indexer.php, it crashed while processing the page where I embedded jplayer stating

various:audio_and_music:start... ☠ Error: Object of class renderer_plugin_text could not be converted to string in /var/www/vhosts/example.com/httpdocs/src/inc/Parsing/Parser.php:112
Stack trace:
#0 /var/www/vhosts/example.com/httpdocs/src/inc/Parsing/Parser.php(112): str_replace()
#1 /var/www/vhosts/example.com/httpdocs/src/inc/parserutils.php(234): dokuwiki\Parsing\Parser->parse()
#2 /var/www/vhosts/example.com/httpdocs/src/inc/Extension/PluginTrait.php(276): p_get_instructions()
#3 /var/www/vhosts/example.com/httpdocs/src/lib/plugins/jplayer/syntax.php(184): dokuwiki\Parsing\ParserMode\Plugin->render_text()
#4 /var/www/vhosts/example.com/httpdocs/src/lib/plugins/text/renderer.php(43): syntax_plugin_jplayer->render()
#5 /var/www/vhosts/example.com/httpdocs/src/inc/parserutils.php(700): renderer_plugin_text->plugin()
#6 /var/www/vhosts/example.com/httpdocs/src/inc/parserutils.php(158): p_render()
#7 /var/www/vhosts/example.com/httpdocs/src/lib/plugins/searchtext/action.php(43): p_cached_output()
#8 /var/www/vhosts/example.com/httpdocs/src/inc/Extension/EventHandler.php(80): action_plugin_searchtext->getSearch()
#9 /var/www/vhosts/example.com/httpdocs/src/inc/Extension/Event.php(75): dokuwiki\Extension\EventHandler->process_event()
#10 /var/www/vhosts/example.com/httpdocs/src/inc/indexer.php(189): dokuwiki\Extension\Event->advise_before()
#11 /var/www/vhosts/example.com/httpdocs/src/bin/indexer.php(86): idx_addPage()
#12 /var/www/vhosts/example.com/httpdocs/src/bin/indexer.php(74): IndexerCLI->index()
#13 /var/www/vhosts/example.com/httpdocs/src/bin/indexer.php(59): IndexerCLI->update()
#14 /var/www/vhosts/example.com/httpdocs/src/vendor/splitbrain/php-cli/src/Base.php(217): IndexerCLI->main()
#15 /var/www/vhosts/example.com/httpdocs/src/vendor/splitbrain/php-cli/src/Base.php(145): splitbrain\phpcli\Base->execute()
#16 /var/www/vhosts/example.com/httpdocs/src/bin/indexer.php(113): splitbrain\phpcli\Base->run()
#17 {main}

After some digging around, I fixed the code adding 1 simple line to syntax.php.

function render($mode, Doku_Renderer $R, $data) {
    $method = "render_$mode";
    if ($method == "render_text") return false; // Line added
    if (method_exists($this, $method)) {
        call_user_func(array($this, $method), $R, $data); 
        return true;
    }
    return false;
}

It seems that the allowed values for $method are only “render_xhtml” and “render_metadata”, which are defined as private functions in the same syntax.php. Why indexer.php has jplayer invoke “render_text” is beyond me.

johng 2024-06-15 17:45

plugin/jplayer.txt · Last modified: 2024-06-15 17:47 by johng

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