# Jquery Ajax to Start and Stop Recordings

**URL:** <https://community.wowza.com/t/jquery-ajax-to-start-and-stop-recordings/34348>\
**Category:** Wowza Streaming Engine\
**Created:** [July 18, 2016, 5:01am UTC](https://community.wowza.com/t/jquery-ajax-to-start-and-stop-recordings/34348 "2016-07-18T05:01:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pip\_Nason](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@Pip\_Nason](https://community.wowza.com/u/Pip_Nason)\
**Post date:** [July 18, 2016, 5:01am UTC](https://community.wowza.com/t/jquery-ajax-to-start-and-stop-recordings/34348/1 "2016-07-18T05:01:50Z")

</div>

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/](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/](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/](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/](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](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

---

<div class="post-metadata">

**Author:** ![Pip\_Nason](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@Pip\_Nason](https://community.wowza.com/u/Pip_Nason)\
**Post date:** [July 19, 2016, 2:31am UTC](https://community.wowza.com/t/jquery-ajax-to-start-and-stop-recordings/34348/2 "2016-07-19T02:31:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andy\_Engberson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/andy_engberson/32/392_2.png) [@Andy\_Engberson](https://community.wowza.com/u/Andy_Engberson)\
**Post date:** [September 2, 2016, 12:16am UTC](https://community.wowza.com/t/jquery-ajax-to-start-and-stop-recordings/34348/3 "2016-09-02T00:16:37Z")

</div>

Hi,

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

Regards,

Andy\_E
