PHP code example of xj / yii2-jplayer-widget
1. Go to this page and download the library: Download xj/yii2-jplayer-widget library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xj / yii2-jplayer-widget example snippets
//CircleAudio Player
echo xj\jplayer\CircleAudioWidget::widget([
'mediaOptions' => [
'm4a' => yii\helpers\Url::base() . '/upload/jplayer-example/Miaow-07-Bubble.m4a',
'oga' => yii\helpers\Url::base() . '/upload/jplayer-example/Miaow-07-Bubble.ogg',
],
]);
//Audio Player
echo xj\jplayer\AudioWidget::widget([
'mediaOptions' => [
'title' => "Bubble",
'm4a' => yii\helpers\Url::base() . '/upload/jplayer-example/Miaow-07-Bubble.m4a',
'oga' => yii\helpers\Url::base() . '/upload/jplayer-example/Miaow-07-Bubble.ogg',
],
'jsOptions' => [
'supplied' => "m4a, oga",
'wmode' => "window",
'smoothPlayBar' => true,
'keyEnabled' => true,
'remainingDuration' => true,
'toggleDuration' => true
],
]);
//Video Player
echo xj\jplayer\VideoWidget::widget([
'tagClass' => 'jp-video jp-video-360p',
'skinAsset' => 'xj\jplayer\skins\PinkAssets', //OR xj\jplayer\skins\BlueAssets
'mediaOptions' => [
'title' => "Big Buck Bunny",
'poster' => yii\helpers\Url::base() . '/upload/jplayer-example/Big_Buck_Bunny_Trailer_480x270.png',
'm4v' => yii\helpers\Url::base() . '/upload/jplayer-example/Big_Buck_Bunny_Trailer.m4v',
'ogv' => yii\helpers\Url::base() . '/upload/jplayer-example/Big_Buck_Bunny_Trailer.ogv',
'webmv' => yii\helpers\Url::base() . '/upload/jplayer-example/Big_Buck_Bunny_Trailer.webm',
],
'jsOptions' => [
'supplied' => "webmv, ogv, m4v",
'size' => [
'width' => "640px",
'height' => "360px",
'cssClass' => "jp-video-360p"
],
'smoothPlayBar' => true,
'keyEnabled' => true,
'remainingDuration' => true,
'toggleDuration' => true
],
]);