Skip to content

Commit

Permalink
added autoPlayOnSetTarget config option
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Sep 25, 2024
1 parent 8da21ba commit 24cb668
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "@/content-handlers/iiif/BaseConfig";

type MediaElementCenterPanelOptions = CenterPanelOptions & {
autoPlayOnSetTarget: boolean;
defaultHeight: number;
defaultWidth: number;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
},
"mediaelementCenterPanel": {
"options": {
"autoPlayOnSetTarget": true,
"defaultHeight": 420,
"defaultWidth": 560,
"titleEnabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ export class MediaElementCenterPanel extends CenterPanel<
}

this.player.setCurrentTime(startTime);
this.player.play();

const duration = (endTime - startTime) * 1000;
if (this.config.options.autoPlayOnSetTarget) {
this.player.play();

setTimeout(() => {
this.player.pause();
}, duration);
const duration = (endTime - startTime) * 1000;

setTimeout(() => {
this.player.pause();
}, duration);
}

return;
}
Expand Down

0 comments on commit 24cb668

Please sign in to comment.