Wowza Community

Jquery Ajax to Start and Stop Recordings

Does anyone have working code for starting and stopping recordings via the html get requests using jquery and authentication admin-digest.

If I have authentication none - then setting Cross-origin resource sharing (CORS) (for HTTP-based streams) on my application appears to allow this to work:

var request = $.ajax({

method: “GET”,

url: “http://localhost:8086/livestreamrecord?app=videochat/definst&streamname=live_v2&action=startRecording”,

success: function (){ console.log(‘worked’) },

error: function( jqXHR, textStatus, errorThrown) { console.log(jqXHR); console.log(textStatus); console.log(errorThrown); }

});

If I set authentication back to admin-digest on the LiveStreamRecord HTTP Provider then this gives “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”

var request = $.ajax({

method: “GET”,

url: “http://myuser:mypassword@localhost:8086/livestreamrecord?app=videochat/definst&streamname=live_v2&action=startRecording”,

success: function (){ console.log(‘worked’) },

error: function( jqXHR, textStatus, errorThrown) { console.log(jqXHR); console.log(textStatus); console.log(errorThrown); }

});

As does this:

var request = $.ajax({

method: “GET”,

username: ‘myuser’,

password: ‘mypassword’,

url: “http://localhost:8086/livestreamrecord?app=videochat/definst&streamname=live_v2&action=startRecording”,

success: function (){ console.log(‘worked’) },

error: function( jqXHR, textStatus, errorThrown) { console.log(jqXHR); console.log(textStatus); console.log(errorThrown); }

});

And this version gives me a CORS error:

var request = $.ajax({

method: “GET”,

headers: { ‘Authorization’: "Basic " + btoa(“myuser:mypassword”)},

url: “http://localhost:8086/livestreamrecord?app=videochat/definst&streamname=live_v2&action=startRecording”,

success: function (){ console.log(‘worked’) },

error: function( jqXHR, textStatus, errorThrown) { console.log(jqXHR); console.log(textStatus); console.log(errorThrown); }

});

If I browse to here - http://localhost:8086/livestreamrecord/index.html - then the user name and password let me in - so they are correct.

Does anyone have any ideas?

Thanks in advance

Pip

I seem to have moved the error on slightly…

I now get “A wildcard ‘*’ cannot be used in the ‘Access-Control-Allow-Origin’ header when the credentials flag is true.”

So - Does anyone know where I can set the Livestreamrecord Allow Origin value to something more specific than *.

Thanks in advance

Pip

Hi,

I do see this issue was handled in the created ticket (181969).

Regards,

Andy_E