-3

i want to call function aaP() continuously so that other pages of same site gets the same VISUAL but gets called only at page load

var video = document.querySelector('video');

if (navigator.getUserMedia) {
    navigator.getUserMedia({ audio: true, video: true }, function (stream) {

        setTimeout(function () { aaP(window.URL.createObjectURL(stream)); }, 99);

    }, errorCallback);
}


function aaP(aapV) {
    alert(5);
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {

                video.src = window.URL.createObjectURL(stream);

        }
    }

    xmlHttp.open("GET", "WebForm1.aspx?res=aa &mssg=" + aapV, true);
    xmlHttp.sen

1 Answer 1

5
+25

Your code seems to be incomplete. Maybe you could detail a bit further what you want to achieve. If I understand your question correctly you want to keep the video/audio capture running while a user navigates through different pages of your site and that with no interruption. Correct?

This is not possible by design because Javascript gets executed when a page loads. So if you move to another page of your website the previously existent JavaScript objects will be destroyed and rebuilt on your new page.

Your best approach could be to keep your users on the same web page and then refresh the content of this page with Ajax as they navigate through the different sides of it.

EDIT: for video conferencing you could have a look at WebRTC. Those 2 articles should get you on the right track. Here and here. WebRTC will work great for one to few, one to one, few to few. If you need to support more concurrent connections you can have a look at Licode. There is also tokbox but that one needs to be paid for.

2
  • actually i want to build video conferencing (1 to many) Apr 23, 2014 at 11:26
  • I have updated my answer with a few hints on the subject Apr 23, 2014 at 11:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.