mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #3350 from MinecraftPlaye/bookplayer-update
Update the resume button after stopping
This commit is contained in:
commit
c2411ab4b5
1 changed files with 16 additions and 5 deletions
|
@ -44,6 +44,12 @@ export class BookPlayer {
|
||||||
stop() {
|
stop() {
|
||||||
this.unbindEvents();
|
this.unbindEvents();
|
||||||
|
|
||||||
|
const stopInfo = {
|
||||||
|
src: this.item
|
||||||
|
};
|
||||||
|
|
||||||
|
Events.trigger(this, 'stopped', [stopInfo]);
|
||||||
|
|
||||||
const elem = this.mediaElement;
|
const elem = this.mediaElement;
|
||||||
const tocElement = this.tocElement;
|
const tocElement = this.tocElement;
|
||||||
const rendition = this.rendition;
|
const rendition = this.rendition;
|
||||||
|
@ -67,6 +73,10 @@ export class BookPlayer {
|
||||||
this.cancellationToken = true;
|
this.cancellationToken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
// Nothing to do here
|
||||||
|
}
|
||||||
|
|
||||||
currentItem() {
|
currentItem() {
|
||||||
return this.item;
|
return this.item;
|
||||||
}
|
}
|
||||||
|
@ -149,8 +159,8 @@ export class BookPlayer {
|
||||||
bindMediaElementEvents() {
|
bindMediaElementEvents() {
|
||||||
const elem = this.mediaElement;
|
const elem = this.mediaElement;
|
||||||
|
|
||||||
elem.addEventListener('close', this.onDialogClosed, {once: true});
|
elem.addEventListener('close', this.onDialogClosed, { once: true });
|
||||||
elem.querySelector('#btnBookplayerExit').addEventListener('click', this.onDialogClosed, {once: true});
|
elem.querySelector('#btnBookplayerExit').addEventListener('click', this.onDialogClosed, { once: true });
|
||||||
elem.querySelector('#btnBookplayerToc').addEventListener('click', this.openTableOfContents);
|
elem.querySelector('#btnBookplayerToc').addEventListener('click', this.openTableOfContents);
|
||||||
elem.querySelector('#btnBookplayerFullscreen').addEventListener('click', this.toggleFullscreen);
|
elem.querySelector('#btnBookplayerFullscreen').addEventListener('click', this.toggleFullscreen);
|
||||||
elem.querySelector('#btnBookplayerPrev')?.addEventListener('click', this.previous);
|
elem.querySelector('#btnBookplayerPrev')?.addEventListener('click', this.previous);
|
||||||
|
@ -250,6 +260,7 @@ export class BookPlayer {
|
||||||
this.streamInfo = {
|
this.streamInfo = {
|
||||||
started: true,
|
started: true,
|
||||||
ended: false,
|
ended: false,
|
||||||
|
item: this.item,
|
||||||
mediaSource: {
|
mediaSource: {
|
||||||
Id: item.Id
|
Id: item.Id
|
||||||
}
|
}
|
||||||
|
@ -263,9 +274,9 @@ export class BookPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
import('epubjs').then(({default: epubjs}) => {
|
import('epubjs').then(({ default: epubjs }) => {
|
||||||
const downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
const downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
||||||
const book = epubjs(downloadHref, {openAs: 'epub'});
|
const book = epubjs(downloadHref, { openAs: 'epub' });
|
||||||
|
|
||||||
// We need to calculate the height of the window beforehand because using 100% is not accurate when the dialog is opening.
|
// We need to calculate the height of the window beforehand because using 100% is not accurate when the dialog is opening.
|
||||||
// In addition we don't render to the full height so that we have space for the top buttons.
|
// In addition we don't render to the full height so that we have space for the top buttons.
|
||||||
|
@ -301,7 +312,7 @@ export class BookPlayer {
|
||||||
epubElem.style.display = 'block';
|
epubElem.style.display = 'block';
|
||||||
rendition.on('relocated', (locations) => {
|
rendition.on('relocated', (locations) => {
|
||||||
this.progress = book.locations.percentageFromCfi(locations.start.cfi);
|
this.progress = book.locations.percentageFromCfi(locations.start.cfi);
|
||||||
Events.trigger(this, 'timeupdate');
|
Events.trigger(this, 'pause');
|
||||||
});
|
});
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue