Skip to content

Commit

Permalink
Implemented video previews in Backend #25
Browse files Browse the repository at this point in the history
- Added previews for create & edit controller
- Added missing translations
- Added copy-to-clipboard for UUIDs
- Fixes and template improvements
  • Loading branch information
nicho90 committed Aug 20, 2017
1 parent 7fcf025 commit 1db4c4d
Show file tree
Hide file tree
Showing 52 changed files with 874 additions and 360 deletions.
67 changes: 34 additions & 33 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
{
"name": "ive",
"homepage": "https://github.com/sitcomlab/IVE",
"authors": [
"Nicholas Schiestel <[email protected]>"
],
"description": "",
"main": "",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "^1.6.4",
"jquery": "^3.1.0",
"angular-route": "^1.6.4",
"angular-translate": "^2.11.1",
"font-awesome": "^4.6.3",
"bootstrap": "v4.0.0-alpha.6",
"angular-socket-io": "^0.7.0",
"socket.io-client": "^1.5.0",
"angular-sanitize": "^1.6.4",
"videogular": "^1.4.4",
"videogular-themes-default": "^1.4.4",
"videogular-controls": "^1.4.4",
"underscore": "^1.8.3",
"angular-underscore-module": "^1.0.3",
"moment": "^2.17.1",
"angular-momentjs": "^0.2.2",
"three.js": "threejs#*",
"components-threejs": "^0.0.79"
},
"resolutions": {
"angular": "1.6.4",
"bootstrap": "v4.0.0-alpha.6"
}
"name": "ive",
"homepage": "https://github.com/sitcomlab/IVE",
"authors": [
"Nicholas Schiestel <[email protected]>"
],
"description": "",
"main": "",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "^1.6.4",
"jquery": "^3.1.0",
"angular-route": "^1.6.4",
"angular-translate": "^2.11.1",
"font-awesome": "^4.6.3",
"bootstrap": "v4.0.0-alpha.6",
"angular-socket-io": "^0.7.0",
"socket.io-client": "^1.5.0",
"angular-sanitize": "^1.6.4",
"videogular": "^1.4.4",
"videogular-themes-default": "^1.4.4",
"videogular-controls": "^1.4.4",
"underscore": "^1.8.3",
"angular-underscore-module": "^1.0.3",
"moment": "^2.17.1",
"angular-momentjs": "^0.2.2",
"three.js": "threejs#*",
"components-threejs": "^0.0.79",
"ngclipboard": "^1.1.1"
},
"resolutions": {
"angular": "1.6.4",
"bootstrap": "v4.0.0-alpha.6"
}
}
3 changes: 3 additions & 0 deletions public/backend/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ footer {
border: 1px solid rgba(0, 0, 0, .125);
}

.uuid {
cursor: pointer;
}

.card-footer > .btn-block-xs-only, .btn-block-xs-only {
margin-top: 1px;
Expand Down
2 changes: 2 additions & 0 deletions public/backend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<script src="../bower_components/angular-translate/angular-translate.min.js"></script>
<script src="../bower_components/angular-underscore-module/angular-underscore-module.js"></script>
<script src="../bower_components/angular-momentjs/angular-momentjs.js"></script>
<script src="../bower_components/clipboard/dist/clipboard.min.js"></script>
<script src="../bower_components/ngclipboard/dist/ngclipboard.min.js"></script>
<script src="../bower_components/videogular/videogular.js"></script>
<script src="../bower_components/videogular-controls/vg-controls.js"></script>
<script src="../bower_components/three.js/dist/three.min.js"></script>
Expand Down
1 change: 1 addition & 0 deletions public/backend/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var app = angular.module("ive", [
"pascalprecht.translate",
"angular-momentjs",
"underscore",
"ngclipboard",
"com.2fdevs.videogular",
"com.2fdevs.videogular.plugins.controls",
//"com.2fdevs.videogular.plugins.overlayplay",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var app = angular.module("ive");

// Relationship embedded_in create controller
app.controller("embeddedInCreateController", function($scope, $rootScope, $routeParams, $filter, $translate, $location, config, $window, $authenticationService, $relationshipService, $scenarioService, $videoService, $overlayService) {
app.controller("embeddedInCreateController", function($scope, $rootScope, $routeParams, $interval, $filter, $translate, $location, config, $window, $authenticationService, $relationshipService, $scenarioService, $videoService, $overlayService, _) {

/*************************************************
FUNCTIONS
Expand Down Expand Up @@ -109,6 +109,7 @@ app.controller("embeddedInCreateController", function($scope, $rootScope, $route
first_video = $scope.videos[0].video_id;
}
$scope.relationship.video_id = first_video;
$scope.findVideo();

// Update UI
$scope.videoDropdown.status = false;
Expand All @@ -128,6 +129,7 @@ app.controller("embeddedInCreateController", function($scope, $rootScope, $route
first_video = $scope.videos[0].video_id;
}
$scope.relationship.video_id = first_video;
$scope.findVideo();

// Update UI
$scope.videoDropdown.status = false;
Expand All @@ -140,14 +142,73 @@ app.controller("embeddedInCreateController", function($scope, $rootScope, $route
break;
}
}
};
};


/**
* [description]
* @return {[type]} [description]
*/
$scope.findVideo = function(){
if($scope.relationship.video_id !== null){
$scope.selectedVideo = _.findWhere($scope.videos, { video_id: $scope.relationship.video_id });
$scope.selectedVideo.thumbnail = $filter('thumbnail')($scope.selectedVideo, 1);
} else {
$scope.selectedVideo;
}
};


/**
* [startPreview description]
* @param {[type]} video [description]
* @return {[type]} [description]
*/
$scope.startPreview = function(video) {
// store the interval promise
$scope.currentPreview = 1;
$scope.maxPreview = video.thumbnails;

// stops any running interval to avoid two intervals running at the same time
$interval.cancel(promise);

// store the interval promise
promise = $interval(function() {
if($scope.selectedVideo.thumbnails > 1){
if($scope.currentPreview >= $scope.maxPreview){
$scope.currentPreview = 1;
}
$scope.selectedVideo.thumbnail = $filter('thumbnail')($scope.selectedVideo, $scope.currentPreview);
}
$scope.currentPreview++;
}, config.thumbnailSpeed);
};

/**
* [stopPreview description]
* @param {[type]} video [description]
* @return {[type]} [description]
*/
$scope.stopPreview = function(video) {
$interval.cancel(promise);
};


/*************************************************
LISTENERS
*************************************************/
$scope.$on('$destroy', function() {
$interval.cancel(promise);
});


/*************************************************
INIT
*************************************************/
$scope.relationship = $relationshipService.init('embedded_in');
$scope.selectedVideo;
$scope.$parent.loading = { status: false, message: "" };
var promise;

// Prepare dropdowns
$scope.overlayDropdown = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var app = angular.module("ive");

// Relationship recorded_at create controller
app.controller("recordedAtCreateController", function($scope, $rootScope, $routeParams, $filter, $translate, $location, config, $window, $authenticationService, $relationshipService, $scenarioService, $locationService, $videoService) {
app.controller("recordedAtCreateController", function($scope, $rootScope, $routeParams, $interval, $filter, $translate, $location, config, $window, $authenticationService, $relationshipService, $scenarioService, $locationService, $videoService, _) {

/*************************************************
FUNCTIONS
Expand Down Expand Up @@ -58,6 +58,7 @@ app.controller("recordedAtCreateController", function($scope, $rootScope, $route
first_video = $scope.videos[0].video_id;
}
$scope.relationship.video_id = first_video;
$scope.findVideo();

// Update UI
$scope.videoDropdown.status = false;
Expand All @@ -77,6 +78,7 @@ app.controller("recordedAtCreateController", function($scope, $rootScope, $route
first_video = $scope.videos[0].video_id;
}
$scope.relationship.video_id = first_video;
$scope.findVideo();

// Update UI
$scope.videoDropdown.status = false;
Expand Down Expand Up @@ -134,12 +136,70 @@ app.controller("recordedAtCreateController", function($scope, $rootScope, $route
}
};

/**
* [description]
* @return {[type]} [description]
*/
$scope.findVideo = function(){
if($scope.relationship.video_id !== null){
$scope.selectedVideo = _.findWhere($scope.videos, { video_id: $scope.relationship.video_id });
$scope.selectedVideo.thumbnail = $filter('thumbnail')($scope.selectedVideo, 1);
} else {
$scope.selectedVideo;
}
};


/**
* [startPreview description]
* @param {[type]} video [description]
* @return {[type]} [description]
*/
$scope.startPreview = function(video) {
// store the interval promise
$scope.currentPreview = 1;
$scope.maxPreview = video.thumbnails;

// stops any running interval to avoid two intervals running at the same time
$interval.cancel(promise);

// store the interval promise
promise = $interval(function() {
if($scope.selectedVideo.thumbnails > 1){
if($scope.currentPreview >= $scope.maxPreview){
$scope.currentPreview = 1;
}
$scope.selectedVideo.thumbnail = $filter('thumbnail')($scope.selectedVideo, $scope.currentPreview);
}
$scope.currentPreview++;
}, config.thumbnailSpeed);
};

/**
* [stopPreview description]
* @param {[type]} video [description]
* @return {[type]} [description]
*/
$scope.stopPreview = function(video) {
$interval.cancel(promise);
};


/*************************************************
LISTENERS
*************************************************/
$scope.$on('$destroy', function() {
$interval.cancel(promise);
});


/*************************************************
INIT
*************************************************/
$scope.relationship = $relationshipService.init('recorded_at');
$scope.selectedVideo;
$scope.$parent.loading = { status: false, message: "" };
var promise;

// Prepare dropdowns
$scope.videoDropdown = {
Expand Down
47 changes: 46 additions & 1 deletion public/backend/js/controllers/relationship/detailsController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var app = angular.module("ive");

// Relationship details controller
app.controller("relationshipDetailsController", function($scope, $rootScope, $routeParams, $filter, $translate, $location, config, $window, $authenticationService, $relationshipService) {
app.controller("relationshipDetailsController", function($scope, $rootScope, $routeParams, $interval, $filter, $translate, $location, config, $window, $authenticationService, $relationshipService) {

/*************************************************
FUNCTIONS
Expand All @@ -17,12 +17,56 @@ app.controller("relationshipDetailsController", function($scope, $rootScope, $ro
};


/**
* [startPreview description]
* @param {[type]} video [description]
* @return {[type]} [description]
*/
$scope.startPreview = function(video) {
// store the interval promise
$scope.currentPreview = 1;
$scope.maxPreview = video.thumbnails;

// stops any running interval to avoid two intervals running at the same time
$interval.cancel(promise);

// store the interval promise
promise = $interval(function() {
if($scope.relationship.thumbnails > 1){
if($scope.currentPreview >= $scope.maxPreview){
$scope.currentPreview = 1;
}
$scope.relationship.thumbnail = $filter('thumbnail')($scope.relationship, $scope.currentPreview);
}
$scope.currentPreview++;
}, config.thumbnailSpeed);
};

/**
* [stopPreview description]
* @param {[type]} video [description]
* @return {[type]} [description]
*/
$scope.stopPreview = function(video) {
$interval.cancel(promise);
};


/*************************************************
LISTENERS
*************************************************/
$scope.$on('$destroy', function() {
$interval.cancel(promise);
});


/*************************************************
INIT
*************************************************/
$scope.$parent.loading = { status: true, message: $filter('translate')('LOADING_RELATIONSHIP') };
$scope.relationship_label = $routeParams.relationship_label;
$scope.relationship_type = $routeParams.relationship_type || undefined;
var promise;

$relationshipService.retrieve_by_id($scope.relationship_label, $routeParams.relationship_id, $scope.relationship_type)
.then(function onSuccess(response) {
Expand All @@ -33,4 +77,5 @@ app.controller("relationshipDetailsController", function($scope, $rootScope, $ro
$window.alert(response.data);
});


});
Loading

1 comment on commit 1db4c4d

@nicho90
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11

Please sign in to comment.