Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player exception bug fix #5125

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/assets/javascripts/media_player_wrapper/avalon_player_new.es6
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,17 @@ class MEJSPlayer {
this.mejsUtility.showControlsBriefly(this.player);
// Fix for paused seeking halt when using structure navigation
// by forcing timeupdate event to fire with a quick and pause
if(this.mediaElement.paused) {
this.mediaElement.play();
this.mediaElement.pause();
if(this.mediaElement.paused && this.mediaElement) {
/** Reference: https://developer.chrome.com/blog/play-request-was-interrupted/ */
let playPromise = this.mediaElement.play();
if(playPromise !== undefined) {
playPromise.then(_ => {
this.mediaElement.pause();
})
.catch(error => {
console.log('Media player error: ', error);
})
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/views/media_objects/_item_view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Unless required by applicable law or agreed to in writing, software distributed
// When viewing video on smaller devices scroll to page content to fully
// display the video player
$(document).ready(function () {
const isVideo = "<%= @currentStreamInfo[:is_video] %>";
const isVideo = <%= @currentStreamInfo[:is_video] %>;
if(isVideo) {
const screenHeight = screen.height;
const playerHeight = document.getElementsByTagName('video')[0].style.height.replace(/[^-\d\.]/g, '');
Expand Down