mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
Merge pull request #3349 from MinecraftPlaye/book-progress
Save reading progress for pdfs for each page
This commit is contained in:
commit
29faa698b7
@ -36,6 +36,12 @@ export class PdfPlayer {
|
|||||||
stop() {
|
stop() {
|
||||||
this.unbindEvents();
|
this.unbindEvents();
|
||||||
|
|
||||||
|
const stopInfo = {
|
||||||
|
src: this.item
|
||||||
|
};
|
||||||
|
|
||||||
|
Events.trigger(this, 'stopped', [stopInfo]);
|
||||||
|
|
||||||
const elem = this.mediaElement;
|
const elem = this.mediaElement;
|
||||||
if (elem) {
|
if (elem) {
|
||||||
dialogHelper.close(elem);
|
dialogHelper.close(elem);
|
||||||
@ -49,6 +55,10 @@ export class PdfPlayer {
|
|||||||
this.cancellationToken = true;
|
this.cancellationToken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
// Nothing to do here
|
||||||
|
}
|
||||||
|
|
||||||
currentItem() {
|
currentItem() {
|
||||||
return this.item;
|
return this.item;
|
||||||
}
|
}
|
||||||
@ -114,8 +124,8 @@ export class PdfPlayer {
|
|||||||
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('.btnExit').addEventListener('click', this.onDialogClosed, {once: true});
|
elem.querySelector('.btnExit').addEventListener('click', this.onDialogClosed, { once: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
bindEvents() {
|
bindEvents() {
|
||||||
@ -181,6 +191,7 @@ export class PdfPlayer {
|
|||||||
this.streamInfo = {
|
this.streamInfo = {
|
||||||
started: true,
|
started: true,
|
||||||
ended: false,
|
ended: false,
|
||||||
|
item: this.item,
|
||||||
mediaSource: {
|
mediaSource: {
|
||||||
Id: item.Id
|
Id: item.Id
|
||||||
}
|
}
|
||||||
@ -218,12 +229,16 @@ export class PdfPlayer {
|
|||||||
if (this.progress === this.duration() - 1) return;
|
if (this.progress === this.duration() - 1) return;
|
||||||
this.loadPage(this.progress + 2);
|
this.loadPage(this.progress + 2);
|
||||||
this.progress = this.progress + 1;
|
this.progress = this.progress + 1;
|
||||||
|
|
||||||
|
Events.trigger(this, 'pause');
|
||||||
}
|
}
|
||||||
|
|
||||||
previous() {
|
previous() {
|
||||||
if (this.progress === 0) return;
|
if (this.progress === 0) return;
|
||||||
this.loadPage(this.progress);
|
this.loadPage(this.progress);
|
||||||
this.progress = this.progress - 1;
|
this.progress = this.progress - 1;
|
||||||
|
|
||||||
|
Events.trigger(this, 'pause');
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceCanvas(canvas) {
|
replaceCanvas(canvas) {
|
||||||
@ -265,8 +280,6 @@ export class PdfPlayer {
|
|||||||
|
|
||||||
renderPage(canvas, number) {
|
renderPage(canvas, number) {
|
||||||
this.book.getPage(number).then(page => {
|
this.book.getPage(number).then(page => {
|
||||||
Events.trigger(this, 'timeupdate');
|
|
||||||
|
|
||||||
const original = page.getViewport({ scale: 1 });
|
const original = page.getViewport({ scale: 1 });
|
||||||
const context = canvas.getContext('2d');
|
const context = canvas.getContext('2d');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user