Search code examples
angularjsstretchvideogular

videogular stretch not working


I have another issue with videogular. The stretch mode is not working for me.

<videogular class="videogular" vg-width="controller.config.width" vg-height="controller.config.height" vg-theme="controller.config.theme" vg-responsive="true" vg-video-stretch="controller.config.stretch.value" vg-stretch="controller.config.stretch.value" vg-player-ready="controller.onPlayerReady($API)" vg-update-state="controller.onUpdateState($state)" vg-update-time="controller.onUpdateTime($currentTime, $duration)">     
    <vg-media vg-src="controller.config.sources" vg-native-controls="false" >
        <video preload='metadata'></video>
    </vg-media>         

    <vg-buffering class="vg-buffering"><div class="bufferingContainer"><div ng-class="spinnerClass" class="loadingSpinner"></div></div></vg-buffering>
</videogular>

And the Javascript.

 var setupVideo = function( ){

    $scope.stretchModes = [
    {label: "None", value: "none"},
    {label: "Fit", value: "fit"},
    {label: "Fill", value: "fill"}
    ];

    controller.config = {
        sources: [
        {src: $sce.trustAsResourceUrl("video/" + _fileName + ".mp4"), type: "video/mp4"},
        {src: $sce.trustAsResourceUrl("video/" + _fileName + ".webm"), type: "video/webm"},
        {src: $sce.trustAsResourceUrl("video/" + _fileName + ".ogg"), type: "video/ogg"}
        ],
        width: 1366,
        height: 768,      
        responsive: true,
        autoPlay: false,
        stretch: $scope.stretchModes[2],
        theme: "css/plugins/videogular.min.css",
        transclude: true

    };  

}

I just need to fit it nicely into the container with either "fit" or "stretch".


Solution

  • I'm the creator of Videogular.

    You're using Videogular 1.0.0 and there's no more vg-width, vg-height and vg-stretch properties.

    Videogular works always as 100% for width and height, so just add to your container the dimensions that you want.

    You have more info here: http://www.videogular.com/examples/simplest-videogular-player/