1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2017-01-25 01:14:35 -05:00
parent 58cebe2486
commit 93ce8f975b
8 changed files with 232 additions and 82 deletions

View file

@ -23,8 +23,6 @@ define(['browser', 'pluginManager', 'events', 'apphost', 'loading', 'playbackMan
var subtitleTrackIndexToSetOnPlaying;
var currentSubtitlesElement;
var currentTrackEvents;
var lastCustomTrackMs = 0;
var currentClock;
var currentAssRenderer;
@ -923,11 +921,6 @@ define(['browser', 'pluginManager', 'events', 'apphost', 'loading', 'playbackMan
window.removeEventListener('resize', onVideoResize);
window.removeEventListener('orientationchange', onVideoResize);
var videoSubtitlesElem = document.querySelector('.videoSubtitles');
if (videoSubtitlesElem) {
videoSubtitlesElem.parentNode.removeChild(videoSubtitlesElem);
}
if (isPlaying) {
var allTracks = mediaElement.textTracks; // get list of tracks
@ -942,8 +935,6 @@ define(['browser', 'pluginManager', 'events', 'apphost', 'loading', 'playbackMan
}
customTrackIndex = -1;
currentSubtitlesElement = null;
currentTrackEvents = null;
currentClock = null;
var renderer = currentAssRenderer;
@ -1084,44 +1075,6 @@ define(['browser', 'pluginManager', 'events', 'apphost', 'loading', 'playbackMan
if (clock) {
clock.seek(timeMs / 1000);
}
var trackEvents = currentTrackEvents;
if (!trackEvents) {
return;
}
if (!currentSubtitlesElement) {
var videoSubtitlesElem = document.querySelector('.videoSubtitles');
if (!videoSubtitlesElem) {
videoSubtitlesElem = document.createElement('div');
videoSubtitlesElem.classList.add('videoSubtitles');
videoSubtitlesElem.innerHTML = '<div class="videoSubtitlesInner"></div>';
videoDialog.appendChild(videoSubtitlesElem);
}
currentSubtitlesElement = videoSubtitlesElem.querySelector('.videoSubtitlesInner');
}
if (lastCustomTrackMs > 0) {
if (Math.abs(lastCustomTrackMs - timeMs) < 500) {
return;
}
}
lastCustomTrackMs = new Date().getTime();
var positionTicks = timeMs * 10000;
for (var i = 0, length = trackEvents.length; i < length; i++) {
var caption = trackEvents[i];
if (positionTicks >= caption.StartPositionTicks && positionTicks <= caption.EndPositionTicks) {
currentSubtitlesElement.innerHTML = caption.Text;
currentSubtitlesElement.classList.remove('hide');
return;
}
}
currentSubtitlesElement.innerHTML = '';
currentSubtitlesElement.classList.add('hide');
}
function getMediaStreamAudioTracks(mediaSource) {

View file

@ -31,32 +31,14 @@
height: 100%;
}
.videoSubtitles {
position: fixed;
bottom: 10%;
text-align: center;
left: 0;
right: 0;
color: #fff;
font-size: 150%;
}
.htmlvideoplayer::-webkit-media-text-track-display {
/*Style the text itself*/
margin-top: -2.5em;
}
.videoSubtitlesInner {
max-width: 70%;
background-color: rgba(0,0,0,.8);
padding: .25em;
margin: auto;
display: inline-block;
}
.htmlvideoplayer::-webkit-media-text-track-display {
/*Style the text itself*/
margin-top: -2.5em;
}
::cue {
background-color: transparent;
text-shadow: 2px 2px 2px rgba(0, 0, 0, 1);
-webkit-font-smoothing: antialiased;
font-family: inherit;
}
.htmlvideoplayer::cue {
background-color: transparent;
text-shadow: 2px 2px 2px rgba(0, 0, 0, 1);
-webkit-font-smoothing: antialiased;
font-family: inherit;
}