Twilio Video start recording manually - twilio

I'm working on a video call web application using Twilio Video REST API and JavaScript SDK 2.8.0.
My requirement is that Users should be able to record video calls only if they want to record, and there is no need to record all calls automatically.
According to twilio documentation, group video rooms created via the REST API can specify whether to record or not in the initial room creation HTTP POST request only. (using RecordParticipantsOnConnect=True)
Is there any possibility to start recording after room was created ?

Currently no. You would have to move participants to another room to record them.

Related

how to show participants lists who are all joined the video call in opentok

I am working on an iOS application (Swift) in which I have used tokbox SDK for adding video chat into iOS app and now I want to add a button called participants when user clicks on participants button i want to show list of people who are all joined the video call.
can anyone guide how to fetch the participants who joined the video call in opentok ?
You can check the streams property on OTSession. This will give you a number of streams in the session and the name given to them when they are published. When a subscriber connects the delegate function allows you to access the stream so you can update whenever that happens. You can check for disconnections via the disconnect delegate function.

API call not allowed for non-Compliance Recording call error in MS Graph Communications Client

I have an application where I am able to make a Bot application, Join Ms teams meeting (by providing joinUrl to my endpoint). I am able to achieve this.
But when I try to start recording the meeting using the Bot (by updating recording status of the call using the below mentioned method), i get the following error :
Code: 8506 Message: API call not allowed for non-Compliance Recording
call
I am using Microsoft.Graph.Communications.Calls v1.2.0.850
To start recording the meeting, I am using the following:
await Call.UpdateRecordingStatusAsync(RecordingStatus.Recording).ConfigureAwait(false);
I have followed the instructions for how to setup a PolicyRecordingCompliance mentioned in PolicyRecordingBot Sample https://github.com/microsoftgraph/microsoft-graph-comms-samples/tree/master/Samples/V1.0Samples/LocalMediaSamples/PolicyRecordingBot
But seems like this Policy is different than the use case which I am trying to achieve.
In the Sample, it requires something as RecordedUser whereas I need my Bot to start recording the meeting as soon as it joins a meeting.

Embed a YouTube channel's current live stream without the video ID

Every time a user starts a live stream on YouTube, a new ID is generated for the stream, along with the corresponding video and URL. Currently, if I want to embed a live stream, I can use YouTube's sharing functions to add the video to my page in an iFrame.
When the user stops streaming, embeds of the live stream automatically switch to showing a recording of that stream. However, if the user starts broadcasting again later on, the embed will continue to show the old recording instead of switching to the new stream. This is because the video ID in the embed is hard-coded and each stream generates a new video ID.
My goal is to create an embed that will automatically display a user's live stream whenever they are streaming, and show an indication of whether they're online or offline. Is there an embed URL that would allow me to do this, or is there something in the API that might help?
I want to embed other streams that aren't just my own, so I need to do this in a way that doesn't require the streamer to log in or authenticate on my site.
If you know the ID of a YouTube channel, and if that channel streams a livestream set to Public, an iframe with this URL will show it:
https://www.youtube.com/embed/live_stream?channel=YOUR_CHANNEL_ID_HERE
See https://stackoverflow.com/a/39582176/470749
Unfortunately I haven't found a similarly simple way to permanently embed the YouTube chat for that livestream.
As far as I can tell, there's nothing built into the YouTube API that would allow you to embed a channel's current live stream automatically without knowing its ID. That said, it's possible to implement this yourself by writing a custom API and hosting it on your own server.
I recognize that this can look like a daunting task, so I've laid out some rough steps below to get you started.
Set up an endpoint on your own server. You could accept a
channelId argument or hard-code one, depending on how extensible
you want this to be.
Query YouTube's search endpoint1 for the specified channelId and eventType=live. An HTTPS request for this will look something like this:https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=[CHANNEL_ID]&eventType=live&maxResults=1&order=date&type=video&key=[YOUR_API_KEY]
Check the search JSON response. If it returns any results (data.pageInfo.totalResults > 0), you know that the channel is live.
If the channel is live, redirect the request to your server directly to the live video's embed URL based on the video's ID in the query response (data.items[0].id.videoId).
If the channel isn't live, create a placeholder as you see fit, or make a second request to search for eventType=completed for past broadcasts, eventType=upcoming for scheduled broadcasts, or remove the eventType parameter to get the most recent video.
Once you have a server that can respond and redirect requests, you can embed an iFrame in your page that points directly to your API URL. Your server will handle the logic and, using the redirect, change the iFrame to a YouTube video player automatically, without requiring you to perform client-side logic or expose your API key2.
1 As with all YouTube API requests, search#list queries will count towards your daily quota. If you intend for this to be a high-traffic endpoint, you could either request an increased quota from YouTube, or implement a caching solution on your end to cut down on the number of requests you make.
2 GCP (Google Cloud Platform), which you'll use to manage your access the YouTube Data API, has pretty good protections against API key theft for times when you do have to expose it on the client side. That being said, best practice is to keep your key secret by storing it only on the server whenever possible.

How does Twilio's "Programmable Video" work?

I'm building a streaming iOS app in Swift. Looking at the docs https://www.twilio.com/docs/api/video I understand that you can create live video chat rooms on the fly.
My use case is a bit different:
User A access a room, hit 'record' and start streaming a video of himself to Twilio storage. Creates a thumbnail in the UI. User B enters the same room and click the video thumbnail - that video should be streamed down to User B.
If user A is talking (Streaming up) and user B is in the room at the same time, it should be possible to 'Go live', which would start a live video chat room that other users can join too.
Main question: Does Twilio Programmable Video allow streaming up and down using their storage?
Secondary question: Would you say Twilio Programmable Video is the right choice for this use case or would you recommend another service?
Twilio developer evangelist here.
I'll answer this the other way around that you asked if that's ok.
If User A is currently streaming to a room and recording it (having created the room in group mode with RecordParticipantsOnConnect set to true) and another user wants to join the room, then they can. They just need an access token that gives them access to the room. They will then be able to join the room and chat and be recorded too.
Once a recording is complete, you will receive a webhook to the statusCallback URL that was set for the room. The callback for the recording will have the recording-complete and will include a MediaURL for the recording as well as the Uri and Sid for the recording resource.
You can use the media URL or the recording resource to get the binary data, which for videos will be in .mkv format. If you want to stream this video to your users, you may want to download the video and convert to a playable format. Or upload it to a streaming service.
Let me know if that helps at all.

Twilio: how to detect which participant is speaking in a conference

I'm working on to implement an audio-only conference app which is something like Google Hangout, but without video.
In Google Hangout, all participants can see which participants is currently speaking, via visual feedback. In other words, when someone starts speaking, their avatar comes foreground of all of participants immediately.
So, here's my questions for Twilio and its client SDKs:
Is there any way to detect current speaker (and give some feedback to users) ?
Is there any way to get input level of a microphone via the SDKs?
Interesting use cases .
I think both these can be achieved with Twilio and here's my views on how to achieve these
Detecting current speaker
What you essentially require is a flag that is globally shared across all participants. This flag should have the facility to be dynamically updated in real time by the speaker who is speaking and at the same time push this information , again in real time , to other participants. So , simply put , you want a shared resource where each Twilio Client can 'publish' and 'subscribe' their 'speaking' state. You could achieve it via Twilio Sync .
To do that , you could create a list object on Sync and add each participants whose audio level goes above a certain level that you consider them speaking . All Client instances in the conference should be subscribed to this list and so on 'itemAdded' or 'itemRemoved' each instance of client can get a list of participants who are speaking . Based on it , UI changes could be done.
You can get audio level (output and input) at each client instance by querying Twilio Voice Insights .For Audio input level , you will have the value passed in parameter named AudioLevelIn .
Note : Both these products require requesting access .

Resources