Get only 2 people to enable video call at a time using agora? - flutter

Is their anyway to have only have two people who can go on a video call at a time from a room on agora. For example their are 20 speakers, and only 2 people at a time can have their video on, and if one closes their video someone else can turn it on. Is their an API for this, or a method to do it?

The concept you are asking about is achievable using the Agora RTC and RTM SDKs. The Agora RTC (Voice/Video) SDK supports up to 17 active broadcasters/host (for 128 hosts see FAQ) but does not have any methods to limit the number below that. This is where Agora RTM can help, it is a signaling layer that enables client side devices to communicate with string and JSON msgs.
I would recommend you take a look at this guide on "Dynamic Channels". It explains how to use RTM to create a lobby where users can see existing channels and either join a channel or create a new one. With some slight modifications you could add limitations to the number of participants.
Specifically in this section, currently there is a check before joining the call, you can change the 4 to 2 it will say the channel is full and not allow others to join. The onTap should look like this:
onTap: () {
// limit channel to 2 people
if (_channelList.values.toList()[index] <= 2) {
joinCall(_channelList.keys.toList()[index], _channelList.values.toList()[index]);
} else {
print('Channel is full');
}
},

Related

Continuous data streaming from NFC to iPhone in Swift?

I have an NFC tag that has integrated environmental sensors inside (MLX90129 to be exact). I would like to make an iPhone app that can read the realtime data from the tag multiple times per second and graph them. I'm not looking for background tag reading, and you can assume that the app will be open and the phone is near the tag at all times.
From what I can see on Apple documentation and other sources, the Swift support for NFC tags is mostly built for single session interrogation. Has anyone succeeded in getting continuous and repeated NFC tag reading for this type of purpose?
As you pointed out: "to make continuous and repeated NFC readings" it's not the intended functionality.
While I think that you can sort this out, there's another thing that could be a headache... to make multiple readings per second it's directly confronted to the current implementation of NFC tag reading in iOS.
Every time you start a reading, it shows the native window which informs the user that you are making a NFC Reading. A part of this process is the interaction of the user, and is exactly that part the one that imposes a time constraint. Even if the interaction with the user is not needed, there is an animation, and that animation has its lifecycle's events (start reading, reading, OK, KO, close...).
Afaik you can't bypass that animation which definitely could represent a couple seconds in the best case.
With that said, you should have a few things in mind, if you still want to try:
NFCTagReaderSession can only have one active reading at a time, and when that reading ends (OK/KO), it should be invalidated. So if you want to make another reading, you'll need to create and configure a new instance.

How to handle responses which take more then 5 seconds

For the google actions that i am developing some responses are complex and take more than 5 seconds to process.
Could someone please suggest how can this be handled.
Generally i would consider using loading dots and then replacing that message with the result but i don't see any Google Action API for it. Also is there any endpoint to which we could async send back the result later ?
Thanks
PS: I am using Conversation API.
We don't really have a good way to handle this right now, but we have a couple of approaches that sorta work based on your needs.
Notifications are currently available for the Assistant on smartphones, and they're coming for speakers. In some cases, it might make sense to say that you're working on the problem and you'll send a notification when you have it, and then resume the conversation from the notification.
Another approach is to use the Media Response to play a bit of "hold music". At the end of the segment of music, your webhook will get a notice that the music has completed. If you have the result available, you can report it at that time.

Testing from JUnit if a SIP Soft Phone is ringing, answered a call, disconnected

I want to initiate calls to two numbers using a 3rd party API. I need to make sure that the devices ring when they get the calls, media starts to transmit when the call is answered, and the call is terminated when hungup.
Ideally I would like to do this from JUnit tests so that I can automate this whole process. But any other tool will also be fine.
So this is what I want to do programatically,
1) Configure two SIP soft phones to answer on 2 different numbers using some credentials provided by the test.
2) Make a call using the API
3) Assert that two phones are in ringing state
4) Answer the call
5) Assert that RTP media is being transmitted among them
6) Hang up
7) Assert that the call is now successfully disconnected
I am quite new to telephony, so would appreciate any pointers on any tool or SDK that will help me accomplish this.
Please check out SipUnit https://code.google.com/p/commtesting/wiki/SipUnit.
It can do all above except check out the media is flowing yet.
Check out the KitCAT framework. It's based on JUnit and can support all of your requirements. It supports multiple user agents, which can all be coordinated within a test case. It also provides coordination with other protocols (e.g., RTP, HTTP).
Sample code:
SIPAgent callee1 = createAgent("callee1"); // sip:callee1#host
SIPAgent callee2 = createAgent("callee2"); // sip:callee2#host
// invoke your API here
invoke3rdPartyAPI(callee1.getSipURI(), callee2.getSipURI());
pause(2000);
assertThat(callee1, is(invited()));
assertThat(callee2, is(invited()));
callee1.answer();
callee2.answer();
pause(500);
assertThat(callee1, is(connectedTo(callee2))); // check for SDP match
callee1.playAudio(audioFileName);
pause(500);
assertThat(callee2, has(incomingMedia());
callee1.disconnect();
pause(500);
assertThat(callee2, is(disconnected()));
Check out the complete API here.

OpenFeint achievements performance

I've decided to integrate OpenFeint into my new game to have achievements and leaderboards.
The game is dynamic and I would like user to be rewarded immediately for some successful results, but as it seems for me, OpenFeint's achievements are a bit sluggish and it shows visual notification only when it receives confirmation from the server.
Is it possible to change something in settings or hack it a little bit to show notification immediately as soon as it checks only local database if the achievement has not been unlocked it?
Not sure if this relates to the Android version of the SDK (which seems even slower), but we couldn't figure out how to make it faster. It was so unacceptably slow that we started developing our own framework that fixes most of open feint's shortcomings and then some. Check out Swarm, it might fit your needs better.
There are several things you can do to more tightly control the timing of these notifications. I'll explain one approach and you can use this as a starting point to explore further on your own. These suggestions apply specifically to iOS apps. One caveat is that these suggestions refer to internal APIs in OFSDK 2.8 for iOS and not ordinarily recommended for high level use and subject to change in future versions.
The first thing I recommend is that you build the sample app with your own product key. Use the standard sample app to experiment before applying the result to your own code.
You are going to get the snappiest response by separating the notification pop-up UI from the process of submitting the achievement. This way you don't have to worry about getting wrapped up in the logic for deciding whether the submission is going just to the local db or is doing the full confirmation on an async network transaction.
See the declaration of "showAchievementNotice" in "OFNotification.h". Performing a search in the sample app, you will see that this is the internal API used for displaying the achievement pop-up when an achievement is earned. It does not actually submit the achievement. You can call this method directly as it is called from "OFAchievementService.mm" to directly control when the message appears. You can then use the following article to disable the pop-up from being called when the actual submission occurs:
http://support.openfeint.com/dev/notification-pop-ups-in-ios/
This gives you complete freedom to call the submission at a later time provided you keep track of the need to do so. For example, you could locally serialize a flag to take care of the actual submission either after the level is done or the next time the app starts up. Don't forget that the user could quit out of a game without cleanly finishing a level.

Does the Rx Framework have any use in a web application?

I have been looking at the Rx Framework aslo refered to as LINQ to events. This is definately a great thing but I have been wondering if anyone sees this as having any uses in web applications rather than just normal windows based apps?
You can use Rx in various call back scenarios, not just when you work 'normal windows apps'. Especially, when you work with Async operations - for ex, you might need to make a call to the server or cloud from your silverlight or desktop client and to receive the data back. Or in cases you'll get a call back from the server (in cases like Polling Duplex).
Also, another scenario for web apps - to invalidate your cache when you receive a data changed event from the model. Just some 'imaginary' code here if you've a cache and model designed accordingly...
var cacheListeners=from sender in myModel.GetDataChangedEvents()
select sender;
//Subscribe
cacheListeners.Subscribe(data=>Cache.Invalidate(data.Key));
Have a look at this http://amazedsaint.blogspot.com/2009/11/systemreactive-or-net-reactive.html
It appears that the original spark for the Rx was around web based programming - in particular to simplify the challenges of AJAX style applications.
Here's a web based example
http://blogs.msdn.com/somasegar/archive/2009/11/18/reactive-extensions-for-net-rx.aspx
See the project http://reactivetrader.com/ to see Rx in use in a web application.