Skip to content

Commit

Permalink
Update the resume button after stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
carif committed Jan 19, 2022
1 parent 0a25f38 commit c8b45f4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/plugins/pdfPlayer/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export class PdfPlayer {
stop() {
this.unbindEvents();

const stopInfo = {
src: this.item
};

Events.trigger(this, 'stopped', [stopInfo]);

const elem = this.mediaElement;
if (elem) {
dialogHelper.close(elem);
Expand All @@ -49,6 +55,10 @@ export class PdfPlayer {
this.cancellationToken = true;
}

destroy() {
// Nothing to do here
}

currentItem() {
return this.item;
}
Expand Down Expand Up @@ -181,6 +191,7 @@ export class PdfPlayer {
this.streamInfo = {
started: true,
ended: false,
item: this.item,
mediaSource: {
Id: item.Id
}
Expand Down Expand Up @@ -218,12 +229,16 @@ export class PdfPlayer {
if (this.progress === this.duration() - 1) return;
this.loadPage(this.progress + 2);
this.progress = this.progress + 1;

Events.trigger(this, 'pause');
}

previous() {
if (this.progress === 0) return;
this.loadPage(this.progress);
this.progress = this.progress - 1;

Events.trigger(this, 'pause');
}

replaceCanvas(canvas) {
Expand Down Expand Up @@ -265,8 +280,6 @@ export class PdfPlayer {

renderPage(canvas, number) {
this.book.getPage(number).then(page => {
Events.trigger(this, 'pause');

const original = page.getViewport({ scale: 1 });
const context = canvas.getContext('2d');

Expand Down

0 comments on commit c8b45f4

Please sign in to comment.