176
Views
5
Comments
Get user media (video and audio) with javascript in mobile app
Question

Hello,


I am trying to use a javascript sdk, from a certain provider, that at some point he says that i must get the media stream of the user, by using the standard javascript way:

navigator.mediaDevices.getUserMedia({audio:true, video_true})
.then(function(stream) {
  /* use the stream */
})
.catch(function(err) {
  /* handle the error */
});

The problem is that this does not work in mobile and i don't understand why. Even if i give all possible permissions to the app through the forge plugin "Android Permissions Plugin".


Can anyone can help me, even if it just to say that this is definetly not possible in mobile because off...


Best regards,


Rui Gomes

UserImage.jpg
Rui Gomes

BTW, just tried with the "Phonegap Media Stream" cordova plugin and did not work also. 


Here is my simple wrapper of this plugin.

PluginPhoneGapMediaStream.oml
2024-06-26 06-49-09
Dileep Kumar Verma

Rui Gomes wrote:

Hello,


I am trying to use a javascript sdk, from a certain provider, that at some point he says that i must get the media stream of the user, by using the standard javascript way:

navigator.mediaDevices.getUserMedia({audio:true, video_true})
.then(function(stream) {
  /* use the stream */
})
.catch(function(err) {
  /* handle the error */
});

The problem is that this does not work in mobile and i don't understand why. Even if i give all possible permissions to the app through the forge plugin "Android Permissions Plugin".


Can anyone can help me, even if it just to say that this is definetly not possible in mobile because off...


Best regards,


Rui Gomes

Hi Rui,

are you able to resolve this issue. I am also facing the same issue.


Thanks

Dileep


2026-03-09 12-26-51
Fábio Fantato
 
MVP

Hi Dileep, try to take a look here https://www.outsystems.com/forge/component-overview/6891/camera-reactive  .

I use a similar code to getMediaDevice using only HTML5. This project works on reactive and mobile applications and doesn't require Cordova. Maybe you can found any difference from your code to figure it out. 


Regards

Fabio


2024-06-26 06-49-09
Dileep Kumar Verma

Fábio Fantato wrote:

Hi Dileep, try to take a look here https://www.outsystems.com/forge/component-overview/6891/camera-reactive  .

I use a similar code to getMediaDevice using only HTML5. This project works on reactive and mobile applications and doesn't require Cordova. Maybe you can found any difference from your code to figure it out. 


Regards

Fabio


Thanks Fabio for the reply!. I will check that.

But right now my requirement, I need to launch  phone video using the above  external JS code, but I am not able to launch that.


Thanks,

Dileep Verma


2025-11-24 16-53-49
Tiago Rodrigues
 
MVP

Hi everyone,

I'm also having this issue regarding audio record.

Here are some findings:

> If I use the emulator or a reactive application, the getUserMedia works fine

> If I generate an app, the getUserMedia works well if I only use video

> If use getUserMedia in the app with "audio: true" it returns NotReadableError (console printscreen in attach)

> If I generate an app that uses, for example "audioinput", it works


According to the error description, there is a problem with my microphone. But it works with other APIs different from MediaDevices API.

The reason why I'm trying to use this is because of the WebRTC. It needs the getUserMedia to return the stream.

Does anyone have an idea what can be or other solution to use WebRTC?

Thanks

getUserMedia.png
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.