-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvg-poster.js
More file actions
59 lines (58 loc) · 1.76 KB
/
Copy pathvg-poster.js
File metadata and controls
59 lines (58 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @license videogular v1.4.4 http://videogular.com
* Two Fucking Developers http://twofuckingdevelopers.com
* License: MIT
*/
/**
* @ngdoc directive
* @name com.2fdevs.videogular.plugins.poster.directive:vgPoster
* @restrict E
* @description
* Shows an image when player hasn't been played or has been completed a video.
* <pre>
* <videogular vg-theme="config.theme.url" vg-autoplay="config.autoPlay">
* <vg-media vg-src="sources"></vg-media>
*
* <vg-poster vg-url='config.plugins.poster.url'></vg-poster>
* </videogular>
* </pre>
*
* @param {string} vgUrl String with a scope name variable. URL to an image supported by the img tag.
* **This parameter is required.**
*
*
*/
"use strict";
angular.module("com.2fdevs.videogular.plugins.poster", [])
.run(
["$templateCache", function ($templateCache) {
$templateCache.put("vg-templates/vg-poster",
'<img ng-src="{{vgUrl}}" ng-class="API.currentState" role="presentation" alt="">');
}]
)
.directive("vgPoster",
[function () {
return {
restrict: "E",
require: "^videogular",
scope: {
vgUrl: "=?"
},
templateUrl: function (elem, attrs) {
return attrs.vgTemplate || 'vg-templates/vg-poster';
},
link: function (scope, elem, attr, API) {
scope.API = API;
if (API.isConfig) {
scope.$watch("API.config",
function () {
if (scope.API.config) {
scope.vgUrl = scope.API.config.plugins.poster.url;
}
}
);
}
}
}
}]
);