Videogular - 如何在 div ng-click 上播放给定的视频文件?

Videogular - how to play given video file on div ng-click?

我有一个项目列表,我想在 ng-click 选定的项目后播放给定 URL 的视频文件。

这意味着应隐藏用于查看的播放器实例,并且在单击列表项后应全屏、循环且无声地播放给定的视频文件。

请问我该怎么做?

我试图通过 API.play() 方法从:

http://www.videogular.com/tutorials/videogular-api/

但是没有运气。

非常感谢您的任何建议。

您可以使用API.toggleFullScreen()方法。

HTML

<div ng-controller="HomeCtrl as controller" class="videogular-container">
  <videogular vg-player-ready="controller.onPlayerReady($API)" vg-theme="controller.config.theme.url">
    <vg-media vg-src="controller.config.sources"
          vg-native-controls="true">
    </vg-media>
  </videogular>

  <div ng-click="controller.API.toggleFullScreen()">open in fullscreen</div>
</div>

JS

'use strict';
angular.module('myApp',
    [
      "ngSanitize",
      "com.2fdevs.videogular"
    ]
  )
  .controller('HomeCtrl',
    function ($sce) {

      this.onPlayerReady = function onPlayerReady(API) {
          this.API = API;
      };

      this.config = {
        preload: "none",
        sources: [
          {src: $sce.trustAsResourceUrl("http://static.videogular.com/assets/videos/videogular.mp4"), type: "video/mp4"},
          {src: $sce.trustAsResourceUrl("http://static.videogular.com/assets/videos/videogular.webm"), type: "video/webm"},
          {src: $sce.trustAsResourceUrl("http://static.videogular.com/assets/videos/videogular.ogg"), type: "video/ogg"}
        ],
        theme: {
          url: "http://www.videogular.com/styles/themes/default/latest/videogular.css"
        }
      };
    }
  );