Skip to content

Instantly share code, notes, and snippets.

@proweb
Last active March 18, 2025 13:44
Show Gist options
  • Save proweb/c5b6519078ca3eb7daafbabdc6871c58 to your computer and use it in GitHub Desktop.
Save proweb/c5b6519078ca3eb7daafbabdc6871c58 to your computer and use it in GitHub Desktop.

Revisions

  1. proweb revised this gist Mar 18, 2025. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions yii2-video-js-widget.php
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    <?= VideoJsWidget::widget( [
    <?php
    echo VideoJsWidget::widget( [
    'options' => [
    'id' => 'main-video',
    'class' => 'video-js',
    @@ -16,4 +17,4 @@
    [ 'src' => Yii::getAlias( '@web/video.mp4' ), 'type' => 'video/mp4' ]
    ]
    ]
    ] ); ?>
    ] );
  2. proweb created this gist Mar 18, 2025.
    19 changes: 19 additions & 0 deletions yii2-video-js-widget.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <?= VideoJsWidget::widget( [
    'options' => [
    'id' => 'main-video',
    'class' => 'video-js',
    'controls' => true,
    'preload' => 'auto',
    'width' => '800',
    'height' => '400'
    ],
    'jsOptions' => [
    // Передаются как параметры скрипта
    'aspectRatio' => '16:9'
    ],
    'tags' => [
    'source' => [
    [ 'src' => Yii::getAlias( '@web/video.mp4' ), 'type' => 'video/mp4' ]
    ]
    ]
    ] ); ?>