Issue with calling when someone has camera off - sinch

There is an issue with the JavaScript library when someone is calling you and you don`t have your camera open. You cannot use the answer or hangup buttons and the ringer goes unlimited time. Maybe you should check if the user has the camera turned on, if not you can auto hangup the call.
I get this error from the sinch.min.js file:
Error retrieving media stream NavigatorUserMediaError {}
The code that generates the error is:
navigator.getUserMedia({
video: d,
audio: !0
}, function(a) {
this.localMediaStream = a, c.resolve(this.localMediaStream)
}.bind(this), function(a) {
console.error("Error retrieving media stream", a)
})

Hey you found a bug in our Beta SDK it sin the backlog for fixing, email me christian#sinch.com and we will send you some Swag in the mean time and a small token of appreciation for testing this with us.

Related

Web Audio Api : navigator.mediaDevices.getUserMedia ---> Error:NotReadableError: Concurrent mic process limit

I am developing a 3D environment that connects two microphones with a specific geometry in my scene , runs locally.
I want to be able to switch between which microphone is being used ( when I press key A use mic1 and when I press key B use mic 2 ).
The error I get is :
Firefox ----> Error:NotReadableError: Concurrent mic process limit.
Chrome -> no Error, it just doesn't switch devices
How can I fix that ? I tried to stop the stream but maybe I am not doing it right , any suggestions ?
async function openMic(nodein){
// inputDevices is an array with the deviceIds
await navigator.mediaDevices.getUserMedia ({audio: { deviceId: {exact:
inputDevices[nodein]}}, video: false})
.then(function(stream) {
console.log('THE DEVICE IS: '+ thisdev);
//soundNodesArray has objects that represent different sources
soundNodesArray[nodein].source=context.createMediaStreamSource(stream);
//making our source a stream connect source with Gain node
soundNodesArray[nodein].source.connect(soundNodesArray[nodein].volume);
//connect Gain node with Panner node
soundNodesArray[nodein].volume.connect(soundNodesArray[nodein].panner);
//connect the Panner Node with the Destination node
soundNodesArray[nodein].panner.connect(context.destination);
})
.catch(function(e){
alert('Error:'+e);
});
}
For stopping the track I call this function first :
async function closeMic(nodeout) {
await navigator.mediaDevices.getUserMedia({audio: true, video: false})
.then(function(mediaStream) {
const tracks = mediaStream.getTracks();
tracks.forEach(function(track) {
track.stop();
console.log('STOPPED STREAM ?????????');
});
})
soundNodesArray[nodeout].source = null;
}
enter code here
enter code here
await ... .then() is not correct.
To open up your stream, do something like this.
let stream // keep the stream so you can stop it later.
async function openMic(nodein){
try {
// inputDevices is an array with the deviceIds
stream = await navigator.mediaDevices.getUserMedia (
{audio: { deviceId: {exact: inputDevices[nodein]}},
video: false})
//soundNodesArray has objects that represent different sources
soundNodesArray[nodein].source=context.createMediaStreamSource(stream)
...
} catch (e) {
alert('Error:' + e)
console.error(e)
}
}
Later, to stop the stream stop all its tracks and forget it exists. Don't use .getUserMedia() to try to get another stream to stop. Instead stop the one you already have.
const tracks = stream.getTracks()
tracks.forEach(track => {track.stop()})
stream = undefined
I'm not familiar with the AudioContext stuff; you may have to stop that stuff too before starting a new stream.
It's best to stop one stream before using getUserMedia() to start another. Some browsers allow you to start one stream before stopping another. Others don't.

TokBox screen sharing audio is not working

I'm using the TokBox / OpenTok screen sharing API for web browser, and when publishing a screen I'm using "publishAudio: true", but the subscriber does not receive any audio. The subscriber does receive the screen video though.
Does anyone know how to solve this audio issue? I'm using Google Chrome on macOS Catalina.
I need see more of you concrete case code but i hope this can help you.
You need to send the audioSource. Example:
if (videoSource) { // in my case, i'm using null or 'screen'
opts.videoSource = videoSource;
}
console.log('micStream getAudioTracks:');
console.log(micStream.getAudioTracks());
opts.audioSource = micStream.getAudioTracks()[0]; //you can choose you audio source
const target = document.getElementById(targetId);
const pub = OT.initPublisher(target, opts, err => {
if (err) {
console.log('err');
reject(err);
} else {
console.log('resolve');
resolve(pub);
}
});
I

Microsoft Teams bot - debug link unfurling

I'm trying to implement pretty simple teams bot but constantly facing an issues with unpredictable behavior. E.g. documentation clearly says that Teams applies Adaptive card as link unfurling response but when I'm sending pretty simple response like:
var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0));
card.Body.Add(new AdaptiveTextBlock { Text = "Title", Size = AdaptiveTextSize.ExtraLarge });
var attachment = new MessagingExtensionAttachment { ContentType = AdaptiveCard.ContentType, Content = card };
var result = new MessagingExtensionResult(AttachmentLayoutTypes.List, "result", new[] { attachment });
return new MessagingExtensionResponse(result);
Teams doesn't render anything or follback to the default behavior.
So the question is - are there any way to debug why it doesn't work?
Had the same issue, the problem is this is not documented at all. You'll need to send a hero card (maybe something else works as well?) as preview and the adaptive card as full card:
return {
composeExtension: {
type: 'result',
attachmentLayout: 'list',
attachments: [{
preview: CardFactory.heroCard("title", "description")
...CardFactory.adaptiveCard(card)
}]
}
};
This will display an "expandable" hero card which resolves to the adaptive card.
one easy way to find out what's going on and if your part is generally ok is by sending a full "static" card as a test. Just create the JSON layout somewhere, load it and sent it unchanged to MS Teams.
Also creating AdaptiveCard's like that is not the best way to do it, have a look at https://learn.microsoft.com/en-us/adaptive-cards/templating/ its a lot easier to handle cards like that.
Specific to your question there's no real way to debug anything inside ms teams. You can get a few errors in the analytics part of the bot framework and some times console output of your browser gives a few hints.
I wrote a similar thing some time ago which inserts a card on specific links similar to what you're trying to do and generally, that was (and still is) working fine.

How to play sound with a music discord bot on heroku

I'm creating a Discord Music Bot in discord.js, I already installed ffmpeg, and everything seems to work normally, but when I execute play command, bot joins a channel, send a message, but doesn't play anything, I've already checked console and it doesn't log anything.
I know it's not a problem with code since it works perfectly locally, the problem is when I try to use heroku, I thought it could be a opusscript problem but I don't know.
I don't find code relevant here, since it works perfectly in my localhost, but when I start to host it at Heroku, nothing happens.
Here you have it, maybe there's an error, but as I said I think the problem is with opusscript or node-opus.
Here are my Heroku buildpacks
And this is my code:
const ytdl = require('ytdl-core');
let voiceChn = message.member.voiceChannel;
if(!voiceChn) return message.channel.send('¡Join a voice channel first!.');
if(!args) return message.channel.send('Add a youtube URL to play it.');
voiceChn.join()
.then(connection => {
const url = ytdl(args.join(' '), { filter : 'audioonly' });
const dispatcher = connection.playStream(url);
message.delete();
message.channel.send('Now playing : '+ args);
}).catch(console.error);
For what its worth I am seeing a very similar issue. My bot should join the channel, play a sound clip from a S3 bucket (which is made public), and then leave.
Here's my code:
async function executePlaySoundCommand(message, filePath) {
try {
const voiceChannel = message.member.voiceChannel;
const connection = await voiceChannel.join();
console.log(`filePath: ${filePath}`);
const file = `${process.env.S3_URL}/${filePath}`;
console.log(`file: ${file}`);
const dispatcher = await connection.playArbitraryInput(file);
console.log('Playback finished');
dispatcher.on('end', () => {
voiceChannel.leave();
});
} catch (err) {
console.log(err);
}
}
Locally the bot will join the channel, play the sound and then leave as expected. However in heroku, the bot will join the channel, then immediately leave.
Below are the sanitized logs from heroku:
Executing <command-name> command
filePath: <audio-file>.mp3
file: https://s3-eu-west-1.amazonaws.com/<s3-bucket-name>/<audio-file>.mp3
Playback finished
I don't think there's anything wrong with my code(?), looking into ffmpeg protocols to see if I have missed something.

cordova record audio not work windows 10 mobile

I work for some time with the media cordova plugin on android and ios mobile on to record audio files. It works well. However on windows, while recording no error occurred, but no file exists. Just when the application goes into background and we return it, an error with code like 2147483648 (I have not found any information relevant to my problem with this code).
function recordAudio() {
var src = "ms-appdata:///temp/sound.m4a";;
var mediaRec = new Media(src,
// success callback
function() {
console.log("recordAudio():Audio Success");
},
// error callback
function(err) {
console.log("recordAudio():Audio Error: "+ err.code);
});
// Record audio
mediaRec.startRecord();
}
I can not find solutions or similar problems. The rest github does not included the problems.
In MediaProxy.js (plugins/cordova-plugin-media/mediaProxy.js)
There is this constant:
var PARAMETER_IS_INCORRECT = -2147024809;
Is this the error you are getting? If so, this only seems to be used in one place, if there is no scheme for the path. Take a look at setTemporaryFsByDefault() in that same file.

Resources