Complete infoscreen video support

Closes issues #5 #7
This commit is contained in:
Joel Lavikainen
2017-05-24 16:44:59 +03:00
parent 7e2cf03ced
commit bec498bfee
10 changed files with 141 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
.fullscreen-bg {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
}
.fullscreen-bg__video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
@@ -0,0 +1,9 @@
<link rel="stylesheet" href="/static/css/video.css">
<div class="fullscreen-bg">
<video autoplay loop class="fullscreen-bg__video">
<source ng-src="{{ video }}" type=video/webm>
Your browser doesn't support WebM videos!
</video>
</div>
@@ -0,0 +1,13 @@
<div ng-controller="infoadmin_video_create" style="margin-top:20px;">
<div>
Create new video. Enter name and select video (.WebM) for upload
</div>
<div class="form-group">
<label>Name:</label>
<input type="text" ng-model="name"></input>
</div>
<div class="form-group">
<input type="file" ngf-select ng-model="video" name="file" required>
</div>
<input type="button" class="btn btn-success" ng-click="send(video);" value="create"></input>
</div>
@@ -145,6 +145,27 @@ app.controller('infoadmin_image_create', ['$scope', 'Upload', '$timeout',"ItemLi
}
}]);
app.controller('infoadmin_video_create', ['$scope', 'Upload', '$timeout',"ItemList", function ($scope, Upload, $timeout,ItemList) {
$scope.send = function(file) {
file.upload = Upload.upload({
url: '/infoscreen/create_video',
data: {name: $scope.name, video: file},
}).then(function (response) {
$timeout(function () {
file.result = response.data;
ItemList.loadItems();
$scope.name= ""
$scope.video = {}
});
},function (response) {
if (response.status > 0)
$scope.errorMsg = response.status + ': ' + response.data;
}, function (evt) {
file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
});
}
}]);
function itemGenerator(create_url){
return function($scope, $http, ItemList){
$scope.item = {}