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.
Yii2 videojs config
<?php
echo 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' ]
]
]
] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment