# deepAR.startVideoRecording() does not record anything

**URL:** <https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520>\
**Category:** Help & Questions\
**Created:** [December 20, 2023, 6:45am UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520 "2023-12-20T06:45:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc-Au](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/marc-au/32/718_2.png) [@Marc-Au](https://forum.deepar.ai/u/Marc-Au)\
**Post date:** [December 20, 2023, 6:45am UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/1 "2023-12-20T06:45:48Z")

</div>

Hi everybody,

I’m trying the deepar web sdk and everything works fine for the pictures. But, for the videos, impossible to record any video (return undefined). It seems like the startVideoRecording function merely does not work.  
If anybody can help me please… ?  
Thanks a lot !

 ![startrecordingnotworking](https://europe1.discourse-cdn.com/flex017/uploads/deepar/original/1X/fc580861ef3cb2f9eeb4ca766721a3a216407315.png)

---

<div class="post-metadata">

**Author:** ![igor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/igor/32/547_2.png) [@igor](https://forum.deepar.ai/u/igor)\
**Post date:** [December 20, 2023, 3:32pm UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/2 "2023-12-20T15:32:09Z")

</div>

The logic you were using makes it impossible to finish recording because you need to press the `record_video` button to finish.

Do note that [`startVideoRecording`](https://docs.deepar.ai/deepar-sdk/deep-ar-sdk-for-web/api-reference/classes/DeepAR.html#startVideoRecording) does not return anything.

Check what you can use from here:

````auto
let isRecording = false;
document.getElementById("record_video").onclick = async function () {
  document.getElementById("record_video").innerHTML = "Save Video";
  if (!isRecording) {
    // Start the recording
    isRecording = true;
    await deepAR.startVideoRecording();

    const startTime = performance.now();
    const i = setInterval(function () {
      const timeElapsed = performance.now() - startTime;
      document.getElementById("duration").innerHTML = 'Time elapsed: ' + Math.round(timeElapsed / 1000) + 's';
      if (!isRecording) {
        output.innerHTML = 'Recording finished.'
        clearInterval(i);
      }
    }, 200);
  } else {
    // Stop recording
    isRecording = false;
    const video = await deepAR.finishVideoRecording();

    document.getElementById("record_video").innerHTML = "Record Video";

    // Download video
    const a = document.createElement("a");
    document.body.appendChild(a);
    a.style = "display: none";
    a.href = window.URL.createObjectURL(video);
    a.download = "video.mp4";
    a.click()
    window.URL.revokeObjectURL(a.href);
  }
};```
````

---

<div class="post-metadata">

**Author:** ![Marc-Au](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/marc-au/32/718_2.png) [@Marc-Au](https://forum.deepar.ai/u/Marc-Au)\
**Post date:** [December 20, 2023, 4:23pm UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/3 "2023-12-20T16:23:32Z")

</div>

Hi Igor

Thanks for your reply.

Well I will try your code and will let you know ASAP

---

<div class="post-metadata">

**Author:** ![Marc-Au](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/marc-au/32/718_2.png) [@Marc-Au](https://forum.deepar.ai/u/Marc-Au)\
**Post date:** [December 20, 2023, 11:37pm UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/4 "2023-12-20T23:37:35Z")

</div>

Hello Igor,

Yes your code works like a charm !

But there’s no sound. And I don’t understand the solution I found in the forum. It is true that we can’t get audio from recording ?

Thanks for your answer.

---

<div class="post-metadata">

**Author:** ![igor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/igor/32/547_2.png) [@igor](https://forum.deepar.ai/u/igor)\
**Post date:** [January 2, 2024, 7:33am UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/5 "2024-01-02T07:33:17Z")

</div>

As stated in the [API reference](https://docs.deepar.ai/deepar-sdk/deep-ar-sdk-for-web/api-reference/classes/DeepAR.html#startVideoRecording) you need to set the `recordAudio` parameter when starting the recording: `await deepAR.startVideoRecording({recordAudio: true});`

---

<div class="post-metadata">

**Author:** ![Marc-Au](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/marc-au/32/718_2.png) [@Marc-Au](https://forum.deepar.ai/u/Marc-Au)\
**Post date:** [January 4, 2024, 3:54am UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/6 "2024-01-04T03:54:23Z")

</div>

Hi Igor,

Well I looked through the documentation and didn’t even see that! But I had developed an alternative solution that works well. However, I will try what the API offers and I will report back. Thank you Igor!

---

<div class="post-metadata">

**Author:** ![Marc-Au](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/marc-au/32/718_2.png) [@Marc-Au](https://forum.deepar.ai/u/Marc-Au)\
**Post date:** [January 13, 2024, 5:32am UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/7 "2024-01-13T05:32:02Z")

</div>

Well @igor the solution is perfect! But… there is another problem. Videos are not created when using a mobile device. This SDK can only be used with a PC. As for photos, no problem: it works with all types of devices. Weird !  
Concerning the videos, the code is of course absolutely the same regardless of the platform (The code itself is above). I thank in advance whoever can find the explanation for me!

---

<div class="post-metadata">

**Author:** ![Marc-Au](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/marc-au/32/718_2.png) [@Marc-Au](https://forum.deepar.ai/u/Marc-Au)\
**Post date:** [February 7, 2024, 9:03pm UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/8 "2024-02-07T21:03:04Z")

</div>

Hello everybody !

Any update about my issue ?

I did some tests with an iPhone and you can make videos apparently without difficulty. The problem only concerns the Android system, where the SDK works for photos, but not for videos… (?).  
If anyone has any idea what’s going on, please post! I thank him in advance!

---

<div class="post-metadata">

**Author:** ![erikayers](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/erikayers/32/822_2.png) [@erikayers](https://forum.deepar.ai/u/erikayers)\
**Post date:** [March 14, 2024, 3:56pm UTC](https://forum.deepar.ai/t/deepar-startvideorecording-does-not-record-anything/520/9 "2024-03-14T15:56:40Z")

</div>

What was your alternative solution? We still have problems getting audio.
