How can I make sure that the audience is not sending a video stream using agora - agora.io

well i am building simple chat room using agora_rtc_engine.. the idea is that there only two people have their own video call. and others can watch them only
now i have the following simple Method that let users join the channel
Future initAgora()async{
chatRoomAgoraEngine = await RtcEngine.create(appId);
if(here i am allowing for only two persons to call enableVideo){
await chatRoomAgoraEngine!.enableVideo();
}
await getToken();
await chatRoomAgoraEngine!.joinChannel(generetingToken, widget.channelName , null,myUid!,);
}
Note:i I finished programming my own server to generate Tokens and so ..
and i implement their full api for that , remote camera , local cam , ... etc
But there is a question that puzzles me
well . the question now : in my previous method i only allow for two users calling await chatRoomAgoraEngine!.enableVideo();and others can call .joinChannel
i am doing great and everything fine .. But is this how there are two people who stream the video?
i read in agora doc that there should be 17 users as maximum who streaming and there unlimited users can watch them but not streaming ..
so my idea that i am letting two user only to call .enableVideo();and others can .joinChannel but not call .enableVideo(); .. do i prevent others from streaming in this way ?

Related

Pwa wrong to consider api cache instead of db?

im building a specific book reader like app.
Main page call api/booksList and receive the json array containing each book info like:
[ { id: server_db_id, title: "title test", sum: 10 , date: ... }
]
ans its cached after the request, so im not saving the book list into indexedDB, localStorage or other storage. If i need one specific book, i just call the api book list again and filter it. Is that bad design? (book will be over 200 items)
Whe user open the book, it call the /api/book/book_id and its cached too, the opened book response is a json list of the lines of the book, eg:
[
{
id: ...
content: "This is line...lore ipsum..."
....
}
]
I put the api response inside vue data variable and the component is rendered correclty
Im not using any kind of handler for keeping this offline by my hand. To detect if user already opened this book, i just call the api, check if errors happened or the responde body has content.
Is that a wrong, bad or stupid decision? Will this hit the quota limit api or other kind of limitation? The "gods" of pwa will raise the finger to me and say: WAAAT. (im not using indexedDB at first because it need some models handling and i want to make things easier if possible)
I my self was just researching this and concluded, at the moment I am going to go with this method, where I use cache for assets, js, css, html etc based on their matching routes.
Then when it comes to data e.g. json requests etc. Its best to store them in indexedDB (or an equivalent), which really does not require a model or schema as such.
See Jake Archibald's IndexedDB-Promise library https://github.com/jakearchibald/idb its really simple to get your head round.
Though both Jake and Addy say it's not a defacto rule, so you can decide ultimately what is best for you.
Read this for better clarification
https://developers.google.com/web/ilt/pwa/live-data-in-the-service-worker
https://medium.com/dev-channel/offline-storage-for-progressive-web-apps-70d52695513c
It helped me to make a better decision on how to go about moving forward.
Recommendations Also
Check out PWA Training: https://developers.google.com/web/ilt/pwa
Workbox: https://developers.google.com/web/tools/workbox (This has sped up my development massively!)
Codelabs: https://codelabs.developers.google.com/ (Search PWA)
The guides on here are really good at taking you through everything you need.
Good Luck with your PWA
Random thought (edit)
One thing that makes me question this though is based on some of the examples and guides I have seen is that, data storage is handled in a more ad-hoc manner. For example, if the PWA calls out an API, there are two methods I have come across where you can either manage cached data in the application or in the service worker, e.g. if your API calls to get JSON fails in the app, it can revert to getting data in the indexedDB which hopefully was pre-cached the first time your app called the API.
Or you can use self.addEventListener('fetch', (event) => { ad-hoc stuff here }) this is where you can match either an asset, or data request and hijack the response with either a cache or indexedDB response. Which prevents the need handle offline data in your app.
The first method makes me feel uneasy so i'm gonna go with the addEventListener approach both in the service worker cause thats what it is there for plus my app does not then have to worry about that.

Updating FBSDKGraphRequest GET for iOS

I am updating the FBSDKGraphRequest and the API Upgrade Tool says I have 2 calls to update. I have updated the SDK to current version (4.31.1) and it says the current Graph API I am using is v.2.11 so I updated that in my app settings on the Facebook Dashboard as well. It says I have to update:
GET {user-id}4.0 =
Starts enforcing the app's restrictions (such as
country or age ) on API calls made without the application's '
appsecret_proof'in the request.
GET {user-id}4.0 =
GET /{user-id}/conversations and GET
/{page-id}/conversations will return fewer fields by default. Use the
'fields' param to explicitly ask for the set of fields you want. If
you ask for an explicit set of fields, the response will not contain
any extra fields that you did not ask for
This is the part that is confusing. I am only using Facebook for login and to post photos to a user's Facebook wall, with:
[[FBSDKGraphRequest alloc] initWithGraphPath:parameters:];
The only parts I access are:
me
me/friends
me/photos
me/videos
I'm not sure how I update the GET call in Objective-C. Is it just telling me I need to ask for more permissions or do I need to add /v.2.11/ to the Graph Request path? These are the current permissions I have granted:
email
public_profile
user_friends
publish_actions
I really don't spend a lot of time using Facebook's SDK so I just need a little help in how I am supposed to update the GET calls. To me it looks like maybe I'm supposed to turn on appsecret_proof and start using that. Also, I am using fields:id in one of my requests already.

YouTube API 2.0 and 3.0 Returning different rresults

I'm working on a website that retrieves public videos from a YouTube channel to populate a video list on the site.
The published page is using the 2.0 version of the API with a base request URL of: http://gdata.youtube.com/feeds/api/users/z8xDwdqXrHVc-8b4ZsA0Sw/uploads?max-results=15
This URL successfully returns the 6 public videos available on the specified channel.
I'm in the process of migrating to the 3.0 API, and I've noticed a discrepancy in the results returned from the new request:
$searchResults = $youtube -> search -> listSearch( 'snippet', array(
'channelId' => 'UCz8xDwdqXrHVc-8b4ZsA0Sw',
'maxResults' => 15,
'type' => 'video'
) );
With this request, I would expect $searchResults to contain the same 6 videos as the old 2.0 API request, however, the 3.0 request returns a response with zero results.
I am reasonably certain that I have ruled out an error in my setup of the Google_Service_YouTube and Google_Client objects.
I replaced the channelId parameter above with the channel ID of my own personal YouTube channel (UC2qJ2qvc_fRp3xLtWKNPucw), and received a response with the 10 public videos I have on that channel.
What would cause this discrepancy?
EDIT
Since making this post, I have removed all videos from the channel in question. The videos were originally uploaded using the export feature available through twitch.tv. I downloaded the original files and resubmitted the videos directly through YouTube, and now all 6 videos appear in the API response as expected.
At this point, I've got the feed working and developed a plan for video upload management that should prevent this from resurfacing. However, I'd still like to understand what would cause the inconsistency. Why would videos uploaded to the channel via Twitch be excluded from the search results?

Passing params to POST API

I am new to designing REST APIs. I have trying to create following APIs for online game play
GET domain/api/games // return all games
POST domain/api/games // create a new game on behalf of current user
Now my issue is that when I try to create game using POST, I want userId to be sent to the API. I am not sure how to do this. Also note that I have another get API to get details of individual game, something like
GET domain/api/games/{gameId}
so I cannot pass userId to POST like domain/api/games/{useID} as it will conflict will above API.
So how do I pass usedId to POST. Also I don't want to use query params. Any suggestions to design this would be great.
When you are making a POST to a service, the parameters you communicate are known as BODY params, they don't go on the query string.
Different technologies have different APIs for interacting with POST params, but the underlying theory is the same, and is described by the W3C HTTP standard
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
The specifics of how to use POST params vary depending on the language and technology you're using. For example, if you are using jquery, there are a couple different ways to do it, with with the $.post('url', data, callback) method or with the $.ajax(...) option.
http://api.jquery.com/jquery.post/
http://api.jquery.com/jquery.ajax/
When reading POST params on the server, you'll generally access them using some some sort of request object, that will store your parameters in memory for you to access. This is highly dependent of the language and framework you're using, but here are links to some common ones:
NodeJS/express: http://expressjs.com/4x/api.html#request
PHP: http://php.net/manual/en/reserved.variables.post.php
ASP.Net: http://msdn.microsoft.com/en-us/library/system.web.httprequest.params(v=vs.110).aspx
Java/Spring: https://spring.io/guides/gs/handling-form-submission/
It should be either part of the context (you can pass it through header) or part of the game object. I prefer the context option, the httpheader can contain some auth bearer token so that you can figure out the user on the backend through the token.

iPhone Transmitting CoreLocation over the Internet

Alrighty, let's try this again!
I'm currently developing an application that will be relying on a web server for some of its functionality. I'm interested, however, in transmitting the user's location to other users who request it. What would be the best possible way to implement this in the application? Thank you! :D
If I were making this application for a standard linux server, I would have a MySQL table called locations, or users. Inside that table, I would store the device id, the latitude, longitude, and date of the users' location. Then, when a user's location changes, update the entry in the table using a HTTP request to a PHP script.
As far as the programming, look into NSURLRequests and NSURLConnections. You would need to do a POST or GET, including this information. This might be an example of the requests:
{ /* Update Location: http://hostname/path/location.php */
action = "updatelocation",
deviceid = "635262f796d3fe35229275d5835bf42861c33f23",
latitude = 0,
longitude = 0
}
Processing on the server wouldn't be too hard. That should at least get you started on storing the locations. Letting other users request the locations would be a little harder.