Tim Starling has submitted this change and it was merged. Change subject: Use TimedMediaHandler to render Ogg Vorbis Player ......................................................................
Use TimedMediaHandler to render Ogg Vorbis Player In Change-Id: I2f19668f7d48d91c8fd1c4fdb324befb5230cc3c TimedMediaHandler adds an option to use TimedMediaTransformOutput without a File object. With that change, Score can use TMH to render the generated Ogg Vorbis file as a player. Change-Id: Ia0e1e164f6b2d94fc0330d4d0e4716aa6275023d --- M Score.body.php M Score.i18n.php 2 files changed, 31 insertions(+), 18 deletions(-) Approvals: Tim Starling: Verified; Looks good to me, approved diff --git a/Score.body.php b/Score.body.php index 2a2b33f..c5f2819 100644 --- a/Score.body.php +++ b/Score.body.php @@ -332,9 +332,9 @@ $options['generate_ogg'] = false; } if ( $options['generate_ogg'] - && !( class_exists( 'OggHandler' ) && class_exists( 'OggAudioDisplay' ) ) ) - { - throw new ScoreException( wfMessage( 'score-noogghandler' ) ); + && !class_exists( 'TimedMediaTransformOutput' ) && !class_exists( 'OggAudioDisplay' ) + ) { + throw new ScoreException( wfMessage( 'score-nomediahandler' ) ); } if ( $options['generate_ogg'] && ( $options['override_ogg'] !== false ) ) { throw new ScoreException( wfMessage( 'score-vorbisoverrideogg' ) ); @@ -363,7 +363,7 @@ * may be generated without stepping on someone else's * toes. The directory may not exist yet. Required. * - generate_ogg: bool Whether to create an Ogg/Vorbis file in - * an OggHandler. If set to true, the override_ogg option + * TimedMediaHandler or OggHandler. If set to true, the override_ogg option * must be set to false. Required. * - dest_storage_path: The path of the destination directory relative to * the current backend. Required. @@ -486,18 +486,31 @@ $link = Html::rawElement( 'a', array( 'href' => $url ), $link ); } if ( $options['generate_ogg'] ) { - $oh = new OggHandler(); - $oh->parserTransformHook( $parser, false ); - $player = new OggHandlerPlayer( array( - 'type' => 'audio', - 'defaultAlt' => '', - 'videoUrl' => $oggUrl, - 'thumbUrl' => false, - 'width' => self::DEFAULT_PLAYER_WIDTH, - 'height' => 0, - 'length' => 0, - 'showIcon' => false, - ) ); + if ( class_exists( 'TimedMediaTransformOutput' ) ){ + $player = new TimedMediaTransformOutput( array( + 'sources' => array( + array( + 'src' => $oggUrl, + 'type' => 'audio/ogg; codecs="vorbis"', + 'disablecontrols' => 'options,timedText' + ) + ), + 'width' => self::DEFAULT_PLAYER_WIDTH + ) ); + } else /* class_exists( 'OggAudioDisplay' ) */ { + $oh = new OggHandler(); + $oh->parserTransformHook( $parser, false ); + $player = new OggHandlerPlayer( array( + 'type' => 'audio', + 'defaultAlt' => '', + 'videoUrl' => $oggUrl, + 'thumbUrl' => false, + 'width' => self::DEFAULT_PLAYER_WIDTH, + 'height' => 0, + 'length' => 0, + 'showIcon' => false, + ) ); + } $link .= $player->toHtml(); } if ( $options['override_ogg'] !== false ) { diff --git a/Score.i18n.php b/Score.i18n.php index f20712e..b21f9d6 100644 --- a/Score.i18n.php +++ b/Score.i18n.php @@ -43,7 +43,7 @@ 'score-noabcinput' => 'ABC source file $1 could not be created.', 'score-noimages' => 'No score images were generated. Please check your score code.', 'score-noinput' => 'Failed to create LilyPond input file $1.', - 'score-noogghandler' => 'Ogg/Vorbis conversion requires an installed and configured OggHandler extension, see [https://www.mediawiki.org/wiki/Extension:OggHandler Extension:OggHandler].', + 'score-nomediahandler' => 'Ogg/Vorbis conversion requires an installed and configured version of either the [https://www.mediawiki.org/wiki/Extension:TimedMediaHandler TimedMediaHandler extension], or the [https://www.mediawiki.org/wiki/Extension:OggHandler OggHandler extension].', 'score-nomidi' => 'No MIDI file generated despite being requested. If you are working in raw LilyPond mode, make sure to provide a proper \midi block.', 'score-nooutput' => 'Failed to create output directory $1.', 'score-notexecutable' => 'Could not execute LilyPond: $1 is not an executable file. Make sure <code>$wgScoreLilyPond</code> is set correctly.', @@ -80,7 +80,7 @@ 'score-noabcinput' => 'Displayed if an ABC source file could not be created for lang="ABC". $1 is the path to the file that could not be created.', 'score-noimages' => 'Displayed if no score images were rendered.', 'score-noinput' => 'Displayed if the LilyPond input file cannot be created. $1 is the path to the input file.', - 'score-noogghandler' => 'Displayed if Ogg/Vorbis rendering was requested without the OggHandler extension installed.', + 'score-nomediahandler' => 'Displayed if Ogg/Vorbis rendering was requested without either the TimedMediaHandler or the OggHandler extensions installed.', 'score-nomidi' => 'Displayed if MIDI file generation was requested but no MIDI file was generated.', 'score-nooutput' => 'Displayed if an output directory could not be created. $1 is the name of the directory.', 'score-notexecutable' => 'Displayed if LilyPond binary cannot be executed. $1 is the path to the LilyPond binary.', -- To view, visit https://gerrit.wikimedia.org/r/51980 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia0e1e164f6b2d94fc0330d4d0e4716aa6275023d Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: J <jger...@wikimedia.org> Gerrit-Reviewer: J <jger...@wikimedia.org> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: Siebrand <siebr...@wikimedia.org> Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits