vision/yii2-you-tube-widget

Simple widget you tube for yii2

Installs: 1 265

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

dev-master 2015-09-15 06:45 UTC

This package is auto-updated.

Last update: 2024-11-27 03:27:18 UTC


README

Simple widget you tube for yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist vision/yii2-you-tube-widget "dev-master"

or add

"vision/yii2-you-tube-widget": "dev-master"

to the require section of your composer.json file.

Usage

Options: "https://developers.google.com/youtube/player_parameters?playerVersion=HTML5&hl=ru#playerapiid"

Events: "https://developers.google.com/youtube/js_api_reference?hl=ru#EventHandlers"

Once the extension is installed, simply use it in your code by :

Minimum:

<?= \vision\ytbwidget\YouTube::widget([
    'videoId' => 'OQQpukc_IM4'    
]) ?>



<?= \vision\ytbwidget\YouTube::widget([

    'videoId' => 'MA6tk7u44mM',
    
    'divId' => 'myDiv', //if set this option in js Globals you player is var player_myDiv, else player_{random val}
    
    'playerVars'=>[
    
        'modestbranding'=>1
        
    ],
    
    'events' => [
    
        'onStateChange' => 'function (event) {
        
            if (event.data == YT.PlayerState.PLAYING) {
            
                console.log("Playing..");
                
            }else if (event.data == YT.PlayerState.PAUSED){
            
                console.log("Paused..");
                
            }else{
            
                console.log("Buffering/Video Ended");
                
            }
            
        }'
        
    ]    
]) ?>