-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy paththe.js
85 lines (74 loc) · 1.95 KB
/
the.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Create your app with 'youtube-embed' dependency
var myApp = angular.module('myApp', ['youtube-embed', 'ngRoute', 'hljs']);
myApp.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'demo/the.html',
controller: 'TheCtrl'
})
.when('/advanced', {
templateUrl: 'demo/advanced.html',
controller: 'AdvancedCtrl'
})
.otherwise('/');
}]).run(function ($rootScope, $window) {
$rootScope.$on('$routeChangeSuccess', function () {
$window.scrollTo(0, 0);
});
});
// Inside your controller...
myApp.controller('TheCtrl', function ($scope) {
// have a video ID
$scope.theBestVideo = 'sMKoNBRZM1M';
// or a URL
$scope.anotherGoodOne = 'https://www.youtube.com/watch?v=18-xvIjH8T4';
});
myApp.controller('AdvancedCtrl', function ($scope) {
$scope.specifiedTime = {
url: 'https://www.youtube.com/watch?v=Im4TO03CuF8#t=10s',
player: null
};
$scope.looper = {
video: 'u2-ZGCoKh-I',
player: null
};
$scope.$on('youtube.player.ended', function ($event, player) {
if (player === $scope.looper.player) {
player.playVideo();
}
});
$scope.custom = {
video: 'FGXDKrUoVrw',
player: null,
vars: {
controls: 0
}
};
$scope.conditional = {
video: '-m-vVKHideI',
visible: false,
toggle: function () {
this.visible = !this.visible;
},
vars: {
autoplay: 1
}
};
$scope.playlist = {
vars: {
list: 'PLISo53ifQd_iBPpybJay-SCAULHsoRicc'
}
};
var first = 'biZLZZFb468';
var second = 'lbVdyPZiOLM';
$scope.dynamic = {
video: first,
change: function () {
if ($scope.dynamic.video === first) {
$scope.dynamic.video = second;
} else {
$scope.dynamic.video = first;
}
}
};
});