Twilio video tracks differentiation - twilio

In my application i have a user that is simultaneously using two video tracks (screen sharing and a webcam). Firs when the user connects The webcam starts and then the screen sharing track gets added.
In the muddle of this session i need an ability to enable the user camera switching. I used this guide here to implement this feature: https://www.twilio.com/blog/2018/06/switching-cameras-twilio-video-chat.html
However when i do something like this:
const tracks = Array.from(localParticipant.videoTracks.values());
localParticipant.unpublishTracks(tracks);
localParticipant.publishTrack(localVideoTrack);
I unpublish both video tracks(screen sharing and camera) and only adding a camera track. Is there a way to add a property to the track(other than "kind") that will allow me to make this distinction?
Because right now the only way i can do it is tracking if the user has screen sharing enabled and re-connect both tracks in this case.

Twilio developer evangelist here.
All Tracks within Twilio Video have a name property which is the track ID by default. However, you can set the name of the track when you create or publish it.
For example:
localParticipant.publishTrack(localVideoTrack, { name: "camera" }
You can then read the name from the LocalTrack or RemoteTrack object later.
Let me know if that helps.

Related

Setup Twitter intent url to open IOS camera to take picture

Wanted to attach a parameter to the Twitter intent URL created:
https://tech.cymi.org/tweet-intents
And prompt IOS user to activate media upload (e.g. open their camera app) to take a picture
I'm guessing the default Twitter intent URL doesn't allow it and a script should be created but not sure which direction to take
For security purposes I don't think they exposed that - as per the intent docs https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/guides/web-intent you are limited to just those parameters. iOS alone btw has one of the strictest security measures such as no video autoplay, user-activated actions to prevent automation; basically any interference with user comfort and engagement is deeply guarded that even with such intent query it would likely not work as needed. You could possibly create a file input field and when pressed you can have it access the camera and append that to a webhook where you can proceed with your project but as for the intent mechanism in itself I think you are limited.

iOS Permission - Ideal Microphone Permission Dialog Text

I have a chat app, and that has an upload function in which the user can upload photos and videos from the gallery or capture one. On iOS, to record video, one needs microphone permission separately (why? - isn't it obvious?). Now whenever I'm trying to submit to App Store, my binary is being rejected because they say:
We noticed that your app requests the user’s consent to access their microphone but does not clarify the use of the microphone in the permission modal alert.
My current permission modal alert text (after several changes) is
Enable microphone access so that you can be heard in the video
And even this latest one was rejected. Is there a better text that I can provide which may be perceived as clearer and my app may pass the review?
Try an easy statement like :
"This app requires the access to Microphone to record your voice memo."
I have this statement in one of my app and it was accepted.
You can use either of these:
1. "We need access to your microphone for adding sounds and uploading them".
2. "We need access to your microphone so that you can add sounds and upload them after choosing".
3. " 'Your ProductName/AppName' uses your microphone to capture audio which is shared with other participants".
4. "We need access to your microphone so that you can record/hear voice messages".
Just simply define the reason why your app is using microphone, i think Fourth one might help you.

iOS app user id without permanent device ID

I have an application (not a game) and the application store some data in server database for the user, so I need a user id to work with.
Since I cannot have a permanent id in ios devices now, I used the google play games login approach.
The user opens the application and gets redirect to safari where he logs in google and returns to the application and I use the google play games ID for identifying my user.
My binary got rejected because of this, so I can use the iOS game services, but it's not a game, so I'm worried to get rejected again, any one used ios game services just to get an identifier for the user in a non-game app before?
Here is the reject message
We noticed an issue in your app that contributes to a lower quality user >experience than Apple users expect:
Upon launching the app, a web page in mobile Safari opens for logging in, then >returns the user to the app. The user should be able to log in without opening >Safari first.
Any other approaches to get an identifier for a user without having to open a browser window at launch?
It will be best if the user does not have to enter a username or password for registration.
Any help is greatly appreciated.
This is a common scenario on iOS. Many apps, such as Angry Birds, requires registering with them or using a third party login such as Facebook, or sometimes a Game Center ID, if you want to ensure you won't lose your data upon uninstall of app.
So, it's typical to use the app vendor ID to identify the user server side until the point you have another ID to identify them.
Of course, the vendor ID is reset upon uninstalling/reinstalling the app. The Game Center ID is unique per app, but consistent between installs, so it seems like the Game Center ID is what Apple would prefer you to use.
From Working with Players in Game Center:
Player Identifier Strings Uniquely Identify Players
Every player
account is uniquely identified by a player identifier string contained
within a GKPlayer object. The identifier string is created when the
player’s account is first created and never changes, even if other
information in the account changes. Thus, player identifiers are the
only reliable way to track a particular player. For this reason, the
Game Kit API uses player identifiers wherever a specific player needs
to be identified. If Game Center needs to identify a specific player
in your game, the Game Kit API returns that player’s identifier. Your
game uses a player identifier to retrieve information from Game Center
about that player.
In addition to using player identifiers in your interactions with Game
Center, your game should also use the player identifier whenever it
wants to store data locally about a specific player. For example, if
your game stores data to track a player’s progress (such as on the
device, on your own server, or on iCloud), use player identifiers to
distinguish between multiple players playing on the same device. That
way, if a different player signs into the device, you can immediately
personalize the experience by showing content specific to that player.
Losing progress when uninstalling is standard behavior. Saving progress even after uninstall or sharing progress between devices by registering or logging in is a bonus.

Facebook custom photo and video sharing action in iOS

I have video and photo sharing working fine in an iOS app using UIActivityViewController.
Now I want to upgrade it so that the app posts a custom OpenGraph story to the timeline. Something like "User posted Video from MySuperApp".
I've got the all the iOS side written, and I've got a Facebook app created and configured in the project, login, etc.
I'm a bit frustrated by the rest of the documentation, though:
The submission guidelines speak about a "user generated photos" permission that doesn't seem to be available anywhere in the app settings, or anywhere else in the documentation. Is that still required? Is there a similar permission for videos?
It says "Photos must be original and can only be those taken with a camera by the person who is publishing them". The app allows adding annotations/drawings on top of a photo. Does that still count as "original"? And I guess the normal image controls allow selecting images from an album, so I have no way to enforce this, do I? (Other than writing a completely custom camera control, I guess...)
The API allows to "stage" a photo for a story. Is it possible to stage a video, or do I need to upload it externally? Can I refer to a video in a user's album in a story?
Is it possible to use FBDialogs to post a story about a video, or do I need to write my own?
Update:
Current status: I wrote my own UIActivity to share on Facebook and my own activity view controller.
Making a custom story about a photo is straightforward, and covered by documentation and examples, but to summarize:
stage photo, returns url
create object, returns id
create action (returns id)
Make sure you set "explicitly_shared" to true, so the action appears in the timeline. It is a good idea to follow their recommendations for error handling as well, otherwise it is a pain to debug.
I am not further with videos, though. Uploading a video is easy ([FBRequest requestForUploadVideo]), but that returns an id. So far I have not been able to use this id in either an object or an action. Querying the graph API for that id doesn't return any information. The video appears on the timeline by itself as well.
I'm tempted to just ditch the custom story about the video.
Update:
Okay, based on the feedback here and on the Facebook group I have to assume that it is not possible to upload and share a video as part of a story. I'm going to strip the feature down to just upload the video to the album.

iOS: can game center account somehow be used for authentication on custom webservice?

Let's say we wan to have a custom backend for a iOS game that manages user accounts and allows the users to send objects to each other, but we don't want to actually have the user to create a dedicated useraccount for our game. It would be possible to simply use the playerID for the usermanagement, but that would not be secure. Is there any way to use a local gamecenter authentication to also authenticate at a custom webservice?
Currently i ponder about how the game 'pocket frogs' enables the players to send gifts to gamecenter friends. Gamecenter doesn't seem to provide this functionality so i assume they use a custom backend for it, but how can such a backend authenticate the player?
I can't say for sure if this is how Pocket Frogs (PF) does it, but based on the fact that only Game Center (GC) friends who also play PF appear on the neighbours list, I think it may work like this:
When a player first starts the game, they get a user id (a 32-bit int, say) from the PF back end which is stored locally. Once the player has this id it can be stored in one of the GC leaderboards under the GKScore context property rather than the value. As far as I can see, PF automatically adds every player to all of the leaderboards pretty much straight away.
Then when another player wants to send a gift, PF gets the leaderboard scores for all of their GC friends and if they have a valid score they must be a PF player and the context value can be read to get their PF id.
In this way the PF back end gets the correct id, but doesn't need to use their GC id.
Incidentally, I tried out the idea of using challenges for sending gifts, and it can work. See http://www.lrgdigital.com/ofgame.html for the game I tried it with - you have to win a game before you can gift it. It has the benefit that you can send the gift to anyone on your friends list rather than only friends who play the game, but there are some limitations as well.
No. Gamecenter uses apple id and that is off limits for obvious reasons. And if you look into the game center framework, there is a way to get gamecenter friends.
Look here to see how to get an array of friends: Game Center Friend List

Resources