@@ -38,7 +38,6 @@ class NodeRtmpSession extends EventEmitter {
3838 this . config = config ;
3939 this . id = NodeCoreUtils . generateNewSessionID ( ) ;
4040 this . bp = new BufferPool ( this . handleData ( ) ) ;
41- this . nodeEvent = NodeCoreUtils . nodeEvent ;
4241 this . socket = socket ;
4342 this . players = null ;
4443
@@ -324,7 +323,7 @@ class NodeRtmpSession extends EventEmitter {
324323 clearImmediate ( this . pingInterval ) ;
325324 this . pingInterval = null ;
326325 }
327- this . nodeEvent . emit ( 'doneConnect' , this . id , this . connectCmdObj ) ;
326+ context . nodeEvent . emit ( 'doneConnect' , this . id , this . connectCmdObj ) ;
328327 this . socket . destroy ( ) ;
329328 context . sessions . delete ( this . id ) ;
330329 }
@@ -811,7 +810,7 @@ class NodeRtmpSession extends EventEmitter {
811810
812811 onConnect ( cmdObj ) {
813812 cmdObj . app = cmdObj . app . replace ( '/' , '' ) ;
814- this . nodeEvent . emit ( 'preConnect' , this . id , cmdObj ) ;
813+ context . nodeEvent . emit ( 'preConnect' , this . id , cmdObj ) ;
815814 if ( ! this . isStarting ) {
816815 return ;
817816 }
@@ -828,11 +827,11 @@ class NodeRtmpSession extends EventEmitter {
828827 this . pingRequest ( ) ;
829828 } , this . ping ) ;
830829 console . log ( '[rtmp connect] app: ' + cmdObj . app ) ;
831- this . nodeEvent . emit ( 'postConnect' , this . id , cmdObj ) ;
830+ context . nodeEvent . emit ( 'postConnect' , this . id , cmdObj ) ;
832831 }
833832
834833 onPublish ( ) {
835- this . nodeEvent . emit ( 'prePublish' , this . id , this . publishStreamPath , this . publishArgs ) ;
834+ context . nodeEvent . emit ( 'prePublish' , this . id , this . publishStreamPath , this . publishArgs ) ;
836835 if ( ! this . isStarting ) {
837836 return ;
838837 }
@@ -864,12 +863,12 @@ class NodeRtmpSession extends EventEmitter {
864863 context . idlePlayers . delete ( idlePlayerId ) ;
865864 }
866865 }
867- this . nodeEvent . emit ( 'postPublish' , this . id , this . publishStreamPath , this . publishArgs ) ;
866+ context . nodeEvent . emit ( 'postPublish' , this . id , this . publishStreamPath , this . publishArgs ) ;
868867 }
869868 }
870869
871870 onPlay ( ) {
872- this . nodeEvent . emit ( 'prePlay' , this . id , this . playStreamPath , this . playArgs ) ;
871+ context . nodeEvent . emit ( 'prePlay' , this . id , this . playStreamPath , this . playArgs ) ;
873872 if ( ! this . isStarting ) {
874873 return ;
875874 }
@@ -951,7 +950,7 @@ class NodeRtmpSession extends EventEmitter {
951950
952951 console . log ( "[rtmp play] join stream " + this . playStreamPath + ' streamId:' + this . playStreamId ) ;
953952 players . add ( this . id ) ;
954- this . nodeEvent . emit ( 'postPlay' , this . id , this . playStreamPath , this . playArgs ) ;
953+ context . nodeEvent . emit ( 'postPlay' , this . id , this . playStreamPath , this . playArgs ) ;
955954 }
956955 }
957956
@@ -972,7 +971,7 @@ class NodeRtmpSession extends EventEmitter {
972971 }
973972 this . isPlaying = false ;
974973 this . playStreamId = del ? 0 : this . playStreamId ;
975- this . nodeEvent . emit ( 'donePlay' , this . id , this . playStreamPath , this . playArgs ) ;
974+ context . nodeEvent . emit ( 'donePlay' , this . id , this . playStreamPath , this . playArgs ) ;
976975 }
977976
978977 if ( this . isPublishing && this . publishStreamId == streamID ) {
@@ -1002,7 +1001,7 @@ class NodeRtmpSession extends EventEmitter {
10021001 context . publishers . delete ( this . publishStreamPath ) ;
10031002 this . isPublishing = false ;
10041003 this . publishStreamId = del ? 0 : this . publishStreamId ;
1005- this . nodeEvent . emit ( 'donePublish' , this . id , this . publishStreamPath , this . publishArgs ) ;
1004+ context . nodeEvent . emit ( 'donePublish' , this . id , this . publishStreamPath , this . publishArgs ) ;
10061005 }
10071006 }
10081007
0 commit comments