cordova-plugin-rtsp-vlc icon indicating copy to clipboard operation
cordova-plugin-rtsp-vlc copied to clipboard

CallBacks stop working after change from activity page.

Open MasterB0t opened this issue 1 year ago • 0 comments

The call backs stop working after the player is play in a second or more pages. Let say we start playing a video in index.js the calls back working after the video end/stop and app move to a second page index2.js and a video is play there the call backs stop working. I will paste a sample code.

index.js

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
  
 
   url = "http://videourl.mp4";
    
   
    var vlcSuccess = function(json) { 
        console.log("SUCCESS "+JSON.stringify(json))
    }

    var vlcError = function(err) { 
        console.log("Error "+err);
    }


    window.VideoPlayerVLC.play(
        url,
        vlcSuccess,
        vlcError
    );

    alert('done');

    window.location = 'page2.html';

}

index2.js

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
  
   
   url = "http://videourl.mp4";
    
    
    var vlcSuccess2 = function(json) { 
        console.log("SUCCESS "+JSON.stringify(json))
    }

    var vlcError2 = function(err) { 
        console.log("Error "+err);
    }


    window.VideoPlayerVLC.play(
        url,
        vlcSuccess2,
        vlcError2
    );

    alert('done');

}

But if I append the code of index2.js to index.js instead of redirect it works..

MasterB0t avatar Sep 08 '23 18:09 MasterB0t