@@ -519,6 +519,12 @@ export default defineComponent({
519519 if ( 'mediaSession' in navigator ) {
520520 navigator . mediaSession . playbackState = 'none'
521521 }
522+
523+ if ( process . env . IS_ELECTRON && this . powerSaveBlocker !== null ) {
524+ const { ipcRenderer } = require ( 'electron' )
525+ ipcRenderer . send ( IpcChannels . STOP_POWER_SAVE_BLOCKER , this . powerSaveBlocker )
526+ this . powerSaveBlocker = null
527+ }
522528 } )
523529
524530 this . player . on ( 'error' , ( error , message ) => {
@@ -527,9 +533,15 @@ export default defineComponent({
527533 if ( 'mediaSession' in navigator ) {
528534 navigator . mediaSession . playbackState = 'none'
529535 }
536+
537+ if ( process . env . IS_ELECTRON && this . powerSaveBlocker !== null ) {
538+ const { ipcRenderer } = require ( 'electron' )
539+ ipcRenderer . send ( IpcChannels . STOP_POWER_SAVE_BLOCKER , this . powerSaveBlocker )
540+ this . powerSaveBlocker = null
541+ }
530542 } )
531543
532- this . player . on ( 'play' , async function ( ) {
544+ this . player . on ( 'play' , async ( ) => {
533545 if ( 'mediaSession' in navigator ) {
534546 navigator . mediaSession . playbackState = 'playing'
535547 }
@@ -541,7 +553,7 @@ export default defineComponent({
541553 }
542554 } )
543555
544- this . player . on ( 'pause' , function ( ) {
556+ this . player . on ( 'pause' , ( ) => {
545557 if ( 'mediaSession' in navigator ) {
546558 navigator . mediaSession . playbackState = 'paused'
547559 }
0 commit comments