Skip to content

Commit aad43fe

Browse files
author
Aalekh Nigam
committed
Create videojsplayer_body.php
Created the file
1 parent e4b5761 commit aad43fe

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

videojsplayer_body.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
class VideoJsPlayer {
3+
static function onParserInit( Parser $parser ) {
4+
5+
global $wgOut;
6+
7+
$wgOut->addModules( 'ext.videojsplayer' );
8+
/*parser loads stylesheet and scripts through this ext.addmodule*/
9+
$parser->setHook( 'videojsplayer', array( 'VideoJsPlayer', 'videojsplayerRender' ) );
10+
/*sethook() initializes the parser function n encountering videojsplayer tag */
11+
return true;
12+
}
13+
static function videojsplayerRender( $input, array $args, Parser $parser, PPFrame $frame ) {
14+
15+
/*makeoutput variable is used to output the html equivalent needed to insert videojsplayer*/
16+
17+
$makeoutput = '<video id="example_video_1" class="video-js vjs-default-skin"controls preload="auto" width="'.htmlspecialchars($args['width']).'" height="'.htmlspecialchars($args['height']).'"poster="" data-setup="{"example_option":true}">';
18+
19+
$makeoutput .= '<source src="'.htmlspecialchars($args['sourcemp4']).'" type="video/mp4" /><source src="'.htmlspecialchars($args['sourcewebm']).'" type="video/webm" /><source src="'.htmlspecialchars($args['sourceogv']).'" type="video/ogg" />';
20+
21+
$makeoutput .= '</video>';
22+
23+
return $makeoutput;
24+
}
25+
}

0 commit comments

Comments
 (0)