Twilio Video in ReactJS - how do I access the room object after the initial setup? - reactjs

My app is built in reactjs. There are a lot of "how tos" for the twilio video javascript sdk, but very little for people who are building in reactjs.
My problem is this: I have successfully implemented the construction and subscription of my users to a room. This is the process:
User 1 lands on user 2's profile, and decides to call. He presses the "call" button.
The server creates a call in the database, contacts Twilio with his info, and returns a twilio token to him.
He then connects to the room, publishes his local audio and video track to it, and waits the invitee
User 2's browser is informed of the call through a push notification from firebase messaging. He is sent a Twilio token from the server in that message, as well as information about the call and the room. His browser pulls up the "incoming call" page.
Assuming he answers, he begins publishing his own local audio and video tracks, and connects to the room.
The video and audio tracks of the other participant are attached to a couple react refs pointing to specific divs on the dom.
The video call is now progressing.
All this works well. However, my question is how do I access the actual room object at this point? Specifically, I want to mute the audio and video tracks based on input from the user. There are enable and disable methods in the Twilio library, but how to get to the tracks? The room creation and set up templates I have found online, which work, do not produce an object which can be modified, after the initial set up. All I get from let room = Video.connect... is a promise. If I use the Video.connect method AGAIN, it seems overkill - why contact Twilio again with my token when I already have a room in progress - and doesn't seem to work when I try.
Any help would be appreciated!

Related

How do I send notification to button with React native firebase cloud message?

I have a post page, and this page will have a button when the correct answer to the question asked in the post is given, just like in stackoverflow, and when this button is pressed, I want the people who follow this post to be notified. I want to send notifications using a react native cloud message.
Calls to the Firebase Cloud Messaging API to send a message require that you specify the FCM server* key in your code. As its name implies, this key should only be used in server-side code, or in an otherwise trusted environment. The reason for this is that anyone who has the FCM server key can send whatever message they want to all of your users. For this reason it is not possible to send a message directly from one device to another device/user through FCM, the messages must always be sent from a trusted environment.
The common approach is to create a custom server-side endpoint/API (using Cloud Functions, or a server that you control) that makes the FCM call on the user's behalf, and then call that endpoint from within your React Native app. For an example of this, see use-case notifying users when something interesting happens in the Firebase documentation.

Can you capture what a user is currently listening to?

I'm currently working on a project that detects when someone is listening to a song on Spotify and sends a message to that person based upon that song being in a playlist.
I couldn't see a spotipy function to get this data, even though I can see it on the spotify application itself, any pointers?
Accessing friends' activity feed is something that many people have been requesting for a long time, however Spotify does not seem to have any plan to open it up unfortunately.
Currently, the only existing workaround I am aware of is to scrape the internal API used by the client, as is done here: https://github.com/valeriangalliat/spotify-buddylist
Another option for your project would be to use last.fm APIs if the user is on it and you know the handle -- which is less than ideal of course.

How send notification into ms teams user from custom tab

I'm designing a custom team tab using React that calls third party API, I need after executing the API successfully, user gets notified . What is the best way to achieve this? I used Bot in my project, but not sure how can I call it from my custom tab class. I'm aware of the existence of proactive messaging, is it the only way to do it? If it is, a pointer on how to implement it to a custom tab would be appreciated.
If you're wanting to message the user 1-1 (like in the personal app), then proactive messaging is definitely what you need (inside a Team, there are other options), and considering you have the bot already in place that's perfect. The only thing you might be missing are the details required to send the actual proactive message (the best time to get them is when the bot is first installed by the user). In particular, you need ConversationId and ServiceUrl.
With regards the concept of Proactive Messaging, basically once the bot is installed, and you have the required values, you can -send- the message from any backend code at all. That can include, for example, custom tab's backend api. You need to identify the user, which you can do using the Teams Context (it's not the safest way but it's the easiest), and then look up the values in your own backend store (e.g. database or whatever) to get the ConversationId and ServiceUrl, then just message the user in your backend.

Signup for email accounts from GAE app

I am faced with a rather strange request and there isn't much material online tackling that.
I am building a web app on GAE ... front end, back end, datastore, blob store, user accounts, the whole nine yards ...
Part of the requirements is to have a user communication system, (users sending messages to each other, just like Facebook) as user emails are not to be shared among other users, and the web app shall only send emails to the user sign up email strictly for security and administration purposes, and wont flood their inbox with notifications like some websites do.
I have narrowed narrowed it down to 4 options
Option 1:
Reinvent the wheel - Build this whole system form scratch on the Datastore and Blob store. However, not only is it expensive, but also I am not gonna go through all of that (just saying honestly)
Option 2:
Build a bouncing system ... User A sends message to app ... app bounces email to User B. Not very Elegant, impossible to create threads and conversations, eats up app Mail Quota used for Marketing and what not.
Option 3:
Host My own Email server onsite. Patch an API servlet and run the whole show through API. Very valid, except that the client doesn't want anything on site, and I wont be around to maintain it for him.
Option 4:(Best option if someone helps out)
Implement option 3 on a 3rd party email provider. Which brings us to the question, is there any respectable email provider that allows account sign up through API ?? I need to create a shadow email account on a 3rd party server(that the user will never know it exists) every time someone makes an account on my app. Then store all emails and their generated passwords in the Datastore, and when user logs in my web app, web app logs in 3rd party server, retrieves messages and serves it. When he wants to send a message, web app gets the message, sends an email using API as well. If someone knows how to do that on Gmail, I would be eternally grateful (but I highly doubt google allows that)
Note
I can implement the whole setup on xmpp/Jabber servers as well but these free servers keep changing all the time and they change their configurations ... bottom line they are not very reliable.
Thanks a lot guys !! I really appreciate any feed back and if you have any other suggestions please don't hesitate !! This is by no means a solid plan yet.

Send data from silverlight application to a particular user in mvc application

I have an mvc application where you have to be registered to log in. So you have your profile page and etc... As a part of the application I have a chat for all users (silverlight page). You enter the chat from your profile page. You have a list of online users there (who logged in on the site and not necessary entered the chat page) but exchange messages you can just with users who did enter the chat page. Otherwise they won't see them. Here is my problem.
So, I want to realize next functionality: if user who didn't enter the chat page was chosen by another to start conversation in chat (silverlight), he should get a pop up message on HIS profile page (mvc) with invitation to the chat. I understand how to send data from silverlight to mvc through WebClient and json format. I don't understand how to reach particular user's profile page. I can think just about some database table with this kind of invitations and some timer on the profile page to check on them.
Please express your ideas, thoughts or opinions in this matter. I would appreciate any help. Thanks in advance.
Maybe you should check out SignalR.
Like you mentioned you need some way to signal another client about the message by checking periodically. SignalR does this for you and in modern browsers uses Websockets to make it even better.
It is very easy to setup and you can build a chat application in a few lines of code. Without the need to save messages in a database (when you don't want to).
Check out this blog post for a sample chat application:
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

Resources