|
|
@@ -11,6 +11,28 @@ angular.module('goApp.background', ['famous.angular', 'goApp.data'])
|
11
|
11
|
|
12
|
12
|
'use strict';
|
13
|
13
|
|
|
14
|
+ var View = $famous['famous/core/View'];
|
|
15
|
+ var Modifier = $famous['famous/core/Modifier'];
|
|
16
|
+ var Surface = $famous['famous/core/Surface'];
|
|
17
|
+ var Transform = $famous['famous/core/Transform'];
|
|
18
|
+ var VideoSurface = $famous['famous/surfaces/VideoSurface'];
|
|
19
|
+ $scope.backgroundView = new View();
|
|
20
|
+
|
|
21
|
+ var video = new VideoSurface({
|
|
22
|
+ size: [undefined, undefined],
|
|
23
|
+ autoplay: true,
|
|
24
|
+ classes: ['bg_video'],
|
|
25
|
+ properties: {
|
|
26
|
+ zIndex: 1,
|
|
27
|
+ }
|
|
28
|
+ });
|
|
29
|
+ var videoModifier = new Modifier();
|
|
30
|
+ videoModifier.transformFrom(function(){
|
|
31
|
+ //transform: Transform.translate(0, 0, 0);
|
|
32
|
+ Transform.translate(0, 0, 0);
|
|
33
|
+ });
|
|
34
|
+ var layer = 1;
|
|
35
|
+
|
14
|
36
|
// Functions
|
15
|
37
|
|
16
|
38
|
$scope.loadBackgroundData = function() {
|
|
|
@@ -30,17 +52,17 @@ angular.module('goApp.background', ['famous.angular', 'goApp.data'])
|
30
|
52
|
|
31
|
53
|
$scope.preload = function() {
|
32
|
54
|
$scope.current_video = $scope.videos[$scope.randomIntFromInterval(0,$scope.videos.length)];
|
33
|
|
- if($scope.current_video == undefined){
|
34
|
|
- $scope.current_video = "content/videos/bg_1.mov"
|
|
55
|
+ if($scope.current_video === undefined){
|
|
56
|
+ $scope.current_video = "content/videos/bg_1.mov";
|
35
|
57
|
}
|
36
|
58
|
var preload = new createjs.LoadQueue();
|
37
|
59
|
console.log("> Preloading video: " + $scope.current_video);
|
38
|
60
|
function handleFileComplete(event) {
|
39
|
61
|
console.log("> Preload Complete");
|
40
|
|
- $scope.startBackgroundVideo();
|
41
|
62
|
$timeout(function(){
|
42
|
63
|
$rootScope.$broadcast('background:loaded');
|
43
|
|
- },1500);
|
|
64
|
+ $scope.startBackgroundVideo();
|
|
65
|
+ },2000);
|
44
|
66
|
}
|
45
|
67
|
preload.addEventListener("fileload", handleFileComplete);
|
46
|
68
|
// for (var i = 0; i < $scope.videos.length; i++) {
|
|
|
@@ -56,33 +78,16 @@ angular.module('goApp.background', ['famous.angular', 'goApp.data'])
|
56
|
78
|
|
57
|
79
|
$scope.startBackgroundVideo = function() {
|
58
|
80
|
console.log("> Playing background video");
|
59
|
|
- var video = new VideoSurface({
|
60
|
|
- size: [undefined, undefined],
|
61
|
|
- autoplay: true,
|
62
|
|
- src: $scope.current_video,
|
63
|
|
- classes: ['bg_video'],
|
64
|
|
- properties: {
|
65
|
|
- zIndex: 1,
|
66
|
|
- }
|
67
|
|
- });
|
|
81
|
+ video.setAttributes({ src: $scope.current_video });
|
68
|
82
|
video.setAttributes({ loop: '' });
|
69
|
|
- var videoModifier = new Modifier();
|
70
|
|
- videoModifier.transformFrom(function(){
|
71
|
|
- //transform: Transform.translate(0, 0, 0);
|
72
|
|
- Transform.translate(0, 0, 0);
|
73
|
|
- });
|
74
|
83
|
$scope.backgroundView.add(videoModifier).add(video);
|
|
84
|
+ $timeout(function(){
|
|
85
|
+ $scope.preload();
|
|
86
|
+ },45000);
|
75
|
87
|
};
|
76
|
88
|
|
77
|
89
|
// Start Background Controller
|
78
|
90
|
|
79
|
|
- var View = $famous['famous/core/View'];
|
80
|
|
- var Modifier = $famous['famous/core/Modifier'];
|
81
|
|
- var Surface = $famous['famous/core/Surface'];
|
82
|
|
- var Transform = $famous['famous/core/Transform'];
|
83
|
|
- var VideoSurface = $famous['famous/surfaces/VideoSurface'];
|
84
|
|
- $scope.backgroundView = new View();
|
85
|
|
-
|
86
|
91
|
$scope.loadBackgroundData();
|
87
|
92
|
|
88
|
93
|
}]);
|