Video Panel doesn't get dismissed when other user hangs call - vline

I've just added vline to my php5/jQuery portal.
Everything seems to work good but a thing that's driving me mad.
Suppose to have two users calling one each other via vline. User1 calls User2, User2 answers, after some time User2 hangs up the call. User1 still sees the Video Panel and he cannot dismiss it.
This happens also il User2 declines the call, User1 sees the Video Panel.
Can someone help me address this issue?
Thanks

I finally managed to make it work by doing the following:
Added a video-wrapper <div> to my html
Created the vline client by passing in this option "uiVideoPanel": "video-wrapper"
handled the following events
enterState:incoming
enterState:outgoing
enterState:closed
as follows:
client = vline.Client.create({
"serviceId": serviceId,
"ui": true,
"uiVideoPanel": "video-wrapper"
});
client.on('enterState:incoming', handleShowWrapper).
on('enterState:outgoing', handleShowWrapper).
on('enterState:closed', handleHideWrapper);
function handleShowWrapper(event) {
$("#video-wrapper").show();
}
function handleHideWrapper(event) {
$("#video-wrapper").html("");
$("#video-wrapper").hide();
}
Obviously it's a workaround but at least it make the call flow work properly.
Let me know if someone has a more elegant solution or if vline manage to solve it and the workaround is no more needed.
Thanks

Related

How to check if AXIOS POST request is sent?

I can't seem to figure out why my console.log(); isn't going off. It seems that everything after the await axios.post(); method doesn't go off? Even my handleClearData(); function isn't going off.
I'm using React with Axios for my contact form to send data to a NodeJS server to then email the data to my email.
Could anyone please explain to me or point me in the right direction on solving this problem? Also, the console.log(res); obviously doesn't return or log anything as well.
Thanks a ton!
UPDATED:
Here's more info. I even took out my function thinking it may have been the problem. It wasn't...
SECOND UPDATE:
Another update!
You'll want to put the console log under handleClearData(); within the (first) try block.
I managed to fix it because await method was waiting for a response from the server. So, on my backend I put this simple line of code, res.send() which then allowed the await function to get out of its infinite loop; therefore, executing the rest of the code that came after it.
Thanks to all that tried to help me! =)
&& happy coding!

How to mention the author of a message in another message

I am using repl.it to develop a bot. I am trying to make a command that makes the bot behave like this:
Someone: !slap #someoneelse
Bot: #Someone slapped #someoneelse
How can I get the bot to mention #someone without using ID? Multiple people will use the command and I can't just use ID since it will only work with one person. I haven't found anything that helped me, and the documentation was no help either. Hopefully, I can get help! Thank you.
Users and members have a .toString() method that is automatically called every time they are concatenated with a string: that means that if you type "Hey " + message.author you will get "Hey #author"
That's how I would do the command:
// First store the mentioned user (it will be undefiend if there's none, check that)
let mentionedUser = message.mentions.users.first();
// Reply by directly putting the User objects in the string:
message.channel.send(`${message.author} slapped ${mentionedUser}`);

ExpressJS, MongoDB + Socket.IO - Identify Individual User Session

I'm using https://github.com/sahat/hackathon-starter/tree/es6. I added Socket.IO but can't figure out a way to safely get current logged in user information . I have a button that when pressed I want to send to the server (Username, Balance, and Amount so I can update their Schema model safely ... So far i was able to so with Jade but I'm sure this is really bad .
JADE:
.content-r-inner.child
.col-md-12.col-xs-12.col-lg-12.no-pad-home
if !user
include partials/flash
include partials/visitorbar
else
include partials/userbar
|
#time.timecontainer.pulsing.pulsingbox
|
.product Product:
|
input#amount(type='text')
|
#slider-range-max
|
#minus1.minus.unselectable -
|
#plus1.plus.unselectable +
// </div>
.sendAmount(onclick="GetAmount()")
// inside include partials/userbar I have GetAmount Function
function GetAmount(){
socket.emit('getAmount', {
"username": "#{user.username}",
"maxBalance": "#{user.balance}",
"getAmount": document.getElementById('amount').value
});
}
{user.username} you can be seen inside tags...
function GetAmount(){
socket.emit('getAmount', {
"username": "JohnDoe",
"maxBalance": "3750",
"getAmount": document.getElementById('amount').value
});
}
I'm sure there is a better more safer way of identifying which user pressed the Button... Hope someone can explain the best way I could achieve it with Socket.IO, just started using it and I find it to be a lot better than Ajax in many ways but currently lack basic understanding of it's methodology and even Mongo for that matter :))
Thank you for your help ! Kudos !!!
Take a look into socketio-jwt (https://github.com/auth0/socketio-jwt) I think it's what you're after. Basically you need authentication for the active users.

Why won't my suitescript deploy scripts fire?

I don't know when this started, but I think it happened after I did some refactoring using the IDE with renaming.
Anyway, if I attach the script through the form, they fire. However, my user event, nor client scripts fire though there is a deployment record. That deployment record uses the same script that works IF it is attached via the form custom code area.
What happened?
EDIT:
For Instance:
Trying to add a button to opportunity:
function userEventBeforeLoad(type, form, request){
var list = form.getSubList("item");
list.addButton('custpage_customconfigurebutton', 'Configure', 'clientStartConfigurator()');
}
Upload Script
Add to "Script"
Deploy:
It never fires when I "Create Opportunity"?
NONE of my user event scripts are firing
EDIT 2 (NEW SCREENS as requested
Following lines of code working for me
function userEventBeforeLoad(type, form, request) {
//nlapiLogExecution('error', 'type', type);
var list = form.getSubList("item");
list.addButton('custpage_customconfigurebutton', 'Configure',"alert('Hello World')");
}
I suspect you might have an error in your clientStartConfigurator(). To verify, you can also use the browser console on click of your button to see whether you're successfully returning from your respective function or not.
Hope this will help you.

"immediate_failed" - Could not automatially log in the user

I have a problem when I developed my website with Google+ sign-in:
I did step by step that the doc told me but I always failed at step4:
https://developers.google.com/+/web/signin/
the result was always ""immediate_failed" - Could not automatially log in the user", I just don't kown why, can anyone help me, thanks very much! :-(
Note that in the sample code you pointed to, the "immediate_failed" check is commented out. This is intentional, since the first time a user encounters the Sign-in button on the page, it will fail.
The reason it fails is that when the page first loads, before the user even presses the button, a request is sent to Google to determine if the user has already logged in (via Google or another site, for example). If they are - there is no need for them to log in again, so the button never needs to be shown. But if they have not been logged in already, you will get the "immediate_failed" response, and will need to either show (or not clear) the button.
tl;dr - Don't worry aout getting immediate_failed when the page first loads. This is normal.
As a workaround I use gapi.auth.authorize method in the gapi.auth.signIn callback. Here is my code:
gapi.auth.signIn({
'callback': gPlusLoginCallback
});
function gPlusLoginCallback(authResult) {
if (authResult['status']['signed_in']) {
doSmth(authRes['access_token']);
} else if (authResult['error'] == "immediate_failed") {
gapi.auth.authorize({
client_id: gplusClientId,
scope: 'https://www.googleapis.com/auth/plus.login email',
immediate: true
}, function (authRes) {
if (authRes['status']['signed_in']) {
doSmth(authRes['access_token']);
}
});
}
}
function doSmth(accessToken){
//Do smth
}
Change this setting "immediate: true", to be false " immediate: false".
But if you like to make more complex implementation look at the first sample here https://developers.google.com/api-client-library/javascript/start/start-js. You have to calls to Google's "gapi.auth.authorize({...", the first one with "immediate: true", and the second one with "immediate: false".
The question is old but I faced this issue recently.
In my case, it was because I specified the URI parameter prompt to none. I guess Google doesn't like that if the user has never been logged to your platform before.
Whenever I changed that to consent or totally removed it, it worked great.
In my case, the error was because of explicitly specifying the authorization parameter prompt to 'none',similar to a previous answer.
It worked for me by specifying prompt=None or as per the official docs,you may skip this parameter.

Resources