File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
xgplayer-streaming-shared/src Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ import Media from './media'
66export default class PlayerWorker {
77 constructor ( ) {
88 this . _bindWorkerEvent ( )
9- globalThis . inPlayerWorker = true
9+ if ( typeof window === 'undefined' ) {
10+ globalThis . inPlayerWorker = true
11+ }
1012 }
1113
1214 postMessage ( type , data = { } ) {
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ export class MSE {
246246 const costTime = nowTime ( ) - this . _st
247247 this . _logger . debug ( 'sourceopen' )
248248 ms . removeEventListener ( 'sourceopen' , onOpen )
249- if ( ! globalThis . inPlayerWorker ) {
249+ if ( ! ( typeof window === 'undefined' && globalThis ? .inPlayerWorker ) ) {
250250 URL . revokeObjectURL ( media . src )
251251 }
252252 this . _openPromise . resolve ( { costtime : costTime } )
@@ -257,7 +257,7 @@ export class MSE {
257257 ms . addEventListener ( 'endstreaming' , this . _onEndStreaming )
258258 }
259259
260- if ( globalThis . inPlayerWorker ) {
260+ if ( typeof window === 'undefined' && globalThis ? .inPlayerWorker ) {
261261 globalThis . postMessage ( {
262262 type : 'handle' , handle : ms . handle
263263 } , [ ms . handle ] )
You can’t perform that action at this time.
0 commit comments