-
Notifications
You must be signed in to change notification settings - Fork 0
/
testUploader.js
46 lines (43 loc) · 1.22 KB
/
testUploader.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
(function(angular) {
'use strict';
TestUploaderController.$inject = ['$scope', '$timeout'];
function TestUploaderController($scope, $timeout) {
var ctrl = this;
ctrl.options = {
maxFileSize: 5000000,
type: "POST",
url:'https://upload.wistia.com/',
acceptFileTypes: /(\.|\/)(avi|mp4|mov)$/i,
dataType: 'json',
autoUpload: true,
loadImageNoRevoke: true,
disableImageLoad: true,
formData: {
api_password: '8697b84951e481b9c121123f43e8dec1e375049d0e262239462cfcf3b864aa48',
project_id: 'zh6toltsrl'
},
start: function (e) {
ctrl.error = null;
},
progress: function (e, data) {
ctrl.progress = parseInt(data.loaded / data.total * 100, 10);
},
done: function (e, data) {
ctrl.mediaHashId = data.result.hashed_id;
$timeout(function() {
var wistiaEmbed = Wistia.embed(ctrl.mediaHashId, {
videoFoam: true,
playerColor: "3B97D3"
});
}, 100);
},
fail: function (e, data) {
ctrl.error = data.errorThrown + " - " + data.result.error;
}
};
}
angular.module('testApp').component('testUploader', {
templateUrl: 'testUploader.html',
controller: TestUploaderController
});
})(window.angular);