Minor fixes
This commit is contained in:
parent
13a5d4059a
commit
ae550b641a
@ -436,12 +436,14 @@
|
||||
'0.75'],
|
||||
4));
|
||||
const currentSpeed = speedSelect.querySelector('#speed-current');
|
||||
speedSelect.querySelectorAll('button').forEach((button) => {
|
||||
if(button === currentSpeed) {
|
||||
return;
|
||||
}
|
||||
const speedButtons = speedSelect.querySelectorAll(
|
||||
'#speed-list button');
|
||||
speedButtons.forEach((button) => {
|
||||
button.addEventListener('click', (event) => {
|
||||
const speed = event.currentTarget.textContent;
|
||||
if(speed === currentSpeed.textContent) {
|
||||
return;
|
||||
}
|
||||
currentSpeed.textContent = speed;
|
||||
this._sources.forEach((source) => {
|
||||
source.playbackRate = speed;
|
||||
@ -557,7 +559,8 @@
|
||||
this._presentation = presentation;
|
||||
this._presTitle.textContent = presentation.title;
|
||||
this._elapsed.textContent = this.formatTime(0);
|
||||
this._duration.textContent = this.formatTime(presentation.duration);
|
||||
this._duration.textContent = this.formatTime(
|
||||
presentation.duration);
|
||||
const sourcenames = Object.keys(presentation.sources);
|
||||
const resolutions = Object.keys(
|
||||
presentation.sources[sourcenames[0]].video);
|
||||
@ -575,7 +578,7 @@
|
||||
|
||||
// create streams
|
||||
const streams = presentation.sources;
|
||||
for(let key in streams) {
|
||||
for(const key in streams) {
|
||||
const stream = streams[key];
|
||||
const streamRoot = parent.createChild('div',
|
||||
{'class': 'stream'});
|
||||
@ -796,27 +799,29 @@
|
||||
resolutions.reverse(),
|
||||
resolutions.length - defaultIndex - 1);
|
||||
const current = select.querySelector('#resolution-current');
|
||||
select.querySelectorAll('button').forEach((button) => {
|
||||
if(button === current) {
|
||||
return;
|
||||
}
|
||||
const buttons = select.querySelectorAll(
|
||||
'#resolution-list button');
|
||||
buttons.forEach((button) => {
|
||||
button.addEventListener('click', (event) => {
|
||||
const res = event.currentTarget.textContent;
|
||||
const time = this._mainSource.currentTime;
|
||||
const paused = this._mainSource.paused;
|
||||
if(res === current.textContent) {
|
||||
return;
|
||||
}
|
||||
// temporarily pause playback for the switch
|
||||
if(!paused) {
|
||||
this.togglePlayback();
|
||||
}
|
||||
if(current.textContent === res) {
|
||||
return;
|
||||
}
|
||||
current.textContent = res;
|
||||
this._sources.forEach((source) => {
|
||||
source.src = source.dataset[res];
|
||||
source.currentTime = time;
|
||||
});
|
||||
this.togglePlayback();
|
||||
// unpause again if we paused before
|
||||
if(!paused) {
|
||||
this.togglePlayback();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user