Skip to content

Commit cc6b0c9

Browse files
author
dularion
committed
working on videoFileSelector
1 parent 60eb407 commit cc6b0c9

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

src/scripts/directives/streamaVideoPlayer.directive.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ angular.module('streama.videoPlayer').directive('streamaVideoPlayer', [
3333
$scope.getBackgroundStyle = getBackgroundStyle;
3434
$scope.changeEpisode = changeEpisode;
3535
$scope.selectSubtitle = selectSubtitle;
36+
$scope.selectVideoFile = selectVideoFile;
37+
$scope.isVideoFileSelected = isVideoFileSelected;
3638
$scope.showControls = showControls;
3739
$scope.toggleSelectEpisodes = toggleSelectEpisodes;
3840
$scope.createNewPlayerSession = createNewPlayerSession;
@@ -135,6 +137,20 @@ angular.module('streama.videoPlayer').directive('streamaVideoPlayer', [
135137
localStorageService.set('selectedSubtitleLanguage', _.get(subtitle, 'subtitleSrcLang'));
136138
}
137139

140+
function selectVideoFile(videoFile){
141+
$scope.initialPlay = false;
142+
$scope.options.customStartingTime = video.currentTime;
143+
$scope.options.selectedVideoFile = videoFile;
144+
$scope.options.videoSrc = (videoFile.src || videoFile.externalLink);
145+
$scope.options.originalFilename = videoFile.originalFilename;
146+
$scope.options.videoType = videoFile.contentType;
147+
localStorageService.set('selectedVideoFile', videoFile.label);
148+
}
149+
150+
function isVideoFileSelected(videoFile){
151+
return _.isEqualBy($scope.options.selectedVideoFile, videoFile, 'id');
152+
}
153+
138154
function getCurrentSubtitleTrack() {
139155
return _.find($scope.options.subtitles, {id: $scope.options.currentSubtitle});
140156
}
@@ -378,7 +394,7 @@ angular.module('streama.videoPlayer').directive('streamaVideoPlayer', [
378394
}
379395

380396

381-
console.log('TIME UPDATE at time: ' + video.currentTime);
397+
// console.log('TIME UPDATE at time: ' + video.currentTime);
382398
}
383399

384400
function determineNextVideoShowing() {

src/scripts/services/streamaVideoPlayer.service.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ angular.module('streama.videoPlayer').factory('streamaVideoPlayerService', [
2626
videoType: '',
2727
videoTrack: '',
2828
subtitles: [],
29+
videoFiles: [],
2930
videoOverlayEnabled: true,
3031
showEpisodeBrowser: false,
3132
hasNextEpisode: false,

src/templates/streama-video-player.trackSelector.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,20 @@ <h2>{{'VIDEO.SUBTITLE_SIZE' | translate}}</h2>
2525
<li class="subtitle-size-sm" ng-class="{'active': options.subtitleSize == 'sm'}" ng-click="changeSubtitleSize('sm')">A</li>
2626
</ul>
2727
</div>
28+
<div class="col-50">
29+
<h2>{{'VIDEO.VIDEO_FILES' | translate}}</h2>
30+
<ul class="track-selector-list">
31+
<li class="track-selector-item" ng-class="{'active': isVideoFileSelected(track)}"
32+
ng-repeat="track in options.videoFiles" ng-click="selectVideoFile(track)">
33+
{{track.label || track.originalFilename}}
34+
35+
36+
<i ng-if="isVideoFileSelected(track)" class="ion-checkmark"></i>
37+
</li>
38+
</ul>
39+
</div>
2840
</div>
2941

3042

3143

32-
</div>
44+
</div>

0 commit comments

Comments
 (0)