Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit

Permalink
Merge pull request #23 from aroskanalen/feature/configurable-video-fo…
Browse files Browse the repository at this point in the history
…rmats

Feature: Configurable video formats
  • Loading branch information
tuj authored Mar 22, 2020
2 parents 27c9a97 + f1418c6 commit f83771e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 64 deletions.
5 changes: 2 additions & 3 deletions Resources/public/apps/ikApp/pages/mediaEdit/media-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ <h1 class="">{{media.name}}</h1>
<div data-ng-switch-when="video" class="create-media--video-container">
<div data-ng-if="media.provider_metadata[0]">
<video width="100%" controls class="create-media--video">
<source data-ng-src="{{videoPath(media, 'ogg')}}" type="video/ogg">
<source data-ng-src="{{videoPath(media, 'mpeg4')}}" type="video/mp4">
<source data-ng-src="{{mediaEntry.reference}}" type="video/{{mediaEntry.format}}" ng-repeat="mediaEntry in media.provider_metadata">
</video>
</div>
<div class="create-media--currently-encoding" data-ng-if="!media.provider_metadata[0]">
Expand Down Expand Up @@ -47,4 +46,4 @@ <h1 class="">{{media.name}}</h1>
<p>Kan ikke slettes - bruges på et eller flere slides</p>
</div>
</section>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -102,39 +102,5 @@ angular.module('ikApp').controller('MediaEditController', ['$scope', '$controlle
var type = media.content_type.split("/");
return type[0];
};

/**
* Sets the correct local path to the video
*
* @param element
* The media element.
*
* @param format
* The desired format to display (ogv, mpeg or thumbnail_SIZE).
*/
$scope.videoPath = function (element, format) {
// Init the filepath.
var filepath = '';

// Loop through the different video formats.
element.provider_metadata.forEach(function (entry) {

// Compare video format to desired format.
if (entry.format === format) {
filepath = entry.reference;
}

// Use thumbnail image.
if (format === 'thumbnail_landscape') {
// Use thumbnail from mp4 landscape.
entry.thumbnails.forEach(function (thumbnail) {
if (thumbnail.label === 'mp4_landscape') {
filepath = thumbnail.reference;
}
});
}
});
return filepath;
};
}
]);
]);
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,10 @@ angular.module('ikShared').directive('ikSlideEditable', [
}
}
else if (scope.ikSlide.media_type === 'video') {
scope.ikSlide.currentVideo = {
'mp4': '',
'ogg': '',
'webm': ''
};
if (scope.ikSlide.media.length > 0 && scope.ikSlide.media[0] !== undefined) {
if (scope.ikSlide.media.length > 0 && scope.ikSlide.media[0].provider_metadata.length > 0) {
// Set current video variable to path to video files.
scope.ikSlide.currentVideo = {};
if (scope.ikSlide.media[0].provider_metadata[0]) {
scope.ikSlide.currentVideo.mp4 = scope.ikSlide.media[0].provider_metadata[0].reference;
}
if (scope.ikSlide.media[0].provider_metadata[1]) {
scope.ikSlide.currentVideo.ogg = scope.ikSlide.media[0].provider_metadata[1].reference;
}
if (scope.ikSlide.media[0].provider_metadata[2]) {
scope.ikSlide.currentVideo.webm = scope.ikSlide.media[0].provider_metadata[2].reference;
}
}

// Reload video player.
$timeout(function () {
element.find('#videoPlayer').load();
}, 1000);
}
// Reload video player.
$timeout(function () {
element.find('#videoPlayer').load();
}, 1000);
}

// Set the currentLogo variable.
Expand Down
2 changes: 1 addition & 1 deletion Resources/public/assets/build/os2displayadmin.min.js

Large diffs are not rendered by default.

0 comments on commit f83771e

Please sign in to comment.