Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Properly cancel and reset ongoing streams when unmounting
Signed-off-by: John Molakvoæ <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
  • Loading branch information
skjnldsv committed Apr 13, 2022
commit 7d77a88f7898007d3b3e728674d0578e8c12f925
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/components/Audios.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export default {
options() {
return {
autoplay: this.active === true,
// Used to reset the audio streams https://github.com/sampotts/plyr#javascript-1
blankVideo: '/blank.aac',
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'settings'],
loadSprite: false,
}
Expand Down Expand Up @@ -94,6 +96,14 @@ export default {
})
},

beforeDestroy() {
// Force stop any ongoing request
console.debug('Closing audio stream', { filename: this.filename })
this.$refs.audio.pause()
this.player.stop()
this.player.destroy()
},

methods: {
donePlaying() {
this.$refs.audio.autoplay = false
Expand Down
10 changes: 10 additions & 0 deletions src/components/Videos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export default {
options() {
return {
autoplay: this.active === true,
// Used to reset the video streams https://github.com/sampotts/plyr#javascript-1
blankVideo: '/blank.mp4',
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'fullscreen'],
loadSprite: false,
}
Expand Down Expand Up @@ -115,6 +117,14 @@ export default {
})
},

beforeDestroy() {
// Force stop any ongoing request
console.debug('Closing video stream', { filename: this.filename })
this.$refs.video.pause()
this.player.stop()
this.player.destroy()
},

methods: {
// Updates the dimensions of the modal
updateVideoSize() {
Expand Down