Skip to content

Commit

Permalink
Merge pull request #2666 from oat-sa/fix/ADF-1861/fix-autoplay-issue
Browse files Browse the repository at this point in the history
fix: Prevent original test media autoplay
  • Loading branch information
Nevermind23 authored Jan 30, 2025
2 parents 2a56af6 + eb43bc8 commit 9d7b5b0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion views/js/loader/qtiLoader.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItemRunner.es5.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItemRunner.min.js.map

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions views/js/qtiCreator/plugins/panel/itemViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,17 @@ define([
}
).then(viewer => {
viewer.on('ready', () => {
// Force to restore the context after rendering the item.
// This is needed as the editor needs to access the context of the item being edited.
// Otherwise, the editor might not work properly.
viewer.getRunner().on('renderitem', restoreCreatorContext);
restoreCreatorContext();
const preventAutoPlay = () => {
$viewerContainer.find('audio, video').each((i, media) => {
media.pause();
});
// Force to restore the context after rendering the item.
// This is needed as the editor needs to access the context of the item being edited.
// Otherwise, the editor might not work properly.
restoreCreatorContext();
};
viewer.getRunner().on('renderitem', preventAutoPlay);
preventAutoPlay();
});
});

Expand Down

0 comments on commit 9d7b5b0

Please sign in to comment.