Search code examples
javascriptvideo.jsrecordingvideo-recordingvideojs-record

Video.js and Videojs-record - requirement to press buttons to start recording


I've inherited a project that uses video.js and videojs-record

In the project I've inherited, the user of the app is required to click twice before recording starts - first, on the camera icon in the middle of the player, and second on the circle 'record' button on the bottom left. (There's also a requirement to accept permissions the first time, but I'm not personally worried about that requirement as I understand its necessity).

But realistically, for my use case, I don't want to ask the user to click anything to record. I want to start recording programatically through javascript, once permissions are accepted.

But even all the examples have the user required to click those two buttons, so I'm starting to think there's no way around it. I looked through all the options and I couldn't find any for this. I see the functions start and stop but when i do player.start() and player.stop() it says undefined.


Solution

  • To start the device use player.record().start()