-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for PIP mode in iOS #237
Comments
Hey @pooja816, As far as I'm aware there is no way to use Picture-in-Picture support with arbitrary video content (such as content drawn by TVIVideoView). If you want PiP like functionality, you would need to add your own support for it at the application level (some sort of draggable UIView which floats on top of your ViewControllers), and you would not be able to display video after backgrounding the app. For reference, here are Apple's docs on I hope this helps, even if its not the answer that you were looking for. Best, |
Thinking about your question a little more, there is no reason why the TwilioVideo objects (like a Room) need to be tied to a specific ViewController. If your goal is to just do more than 1 thing at a time inside your application (forgetting about backgrounding concerns), then you could write a model controller class which is responsible for managing the usage of TwilioVideo and coordinating with your UIViewController(s) to display content, and respond to user interactions. Our sample code uses a single ViewController for simplicity, but there is nothing preventing your app from organizing and managing the SDK objects differently. |
Hey @pooja816, I never heard back from you. Are you looking for more comprehensive sample code, or Best, |
Hi @ceaglest |
Hi @ceaglest Is there any way to add the view in the status bar(UI like when our app move to background and the call continues). Please help me as I am stuck on this. |
Hi @pooja816,
Not that I'm aware of, you shouldn't interact with the status bar directly. Apple's PiP support allows you to play in the background as long as you use AVPlayer. I don't believe the status bar is part of your key UIWindow, but rather something that springboard, or UIKit provides.
I don't have an example to share at the moment, but we do plan on offering something more complex which will use multiple view controllers in the future. I'll be in touch once we have a concrete example. Best, |
Hi @ceaglest
|
Hi @ceaglest |
Hi @pooja816, Sorry for the long delay, somehow I missed your last response.
What kind of Room are you using? Disabling a LocalVideoTrack will cause black frames to be sent in a Peer-to-Peer Room, but in a Group Room you should get the final frame and no black frames when pausing.
Can you provide more information here? What is the sequence of events from our SDK? Did you get a track removed callback? How do you manage your renderer when pushing / popping more view controllers? Best, |
Hi @ceaglest
Yes, I am using Peer-to-Peer Room. How to create a Group Room?
No, I am not getting callback on track removed. How to remove a track?
When the call starts for the first time, the room is created and the participant is added to the room and when the call connects, the callback is received on addedVideoTrack and the remote video of the other participant is rendered. On popping the videoCall view, I am only disabling localVideoTrack. And when I move to video call screen again, I am initialising the localVideoTrack using following code-
|
@pooja816 Thanks for responding back with information. Chris is on vacation for the rest of the week, in the meantime, let me try to help solve the problem -
Here is the REST API and documentation on how to create group Room. You can use
You can remove a video track by calling Let me know if you have any questions. |
Hi @piyushtank |
@pooja816 Thanks for sharing the code. I will try it out and let you know my findings. |
@pooja816 I tried the sample code. I noticed you have added When you press on new call and connect to a Room, ViewController2 gets pushed on top of ViewController1. When you are connected to a Room, it displays two buttons "Back" and "Settings". All ok till this point. Now you can observe call works as expected while comming back from Settings screen but does not give expected results while returning from On the other end, when you press the "Settings" button, ViewController2 does not get destroyed and the SettingsViewController gets pushed on top. So while coming back to ViewController2 from SettingsViewController, call remains connected because it is using the existing ViewController2. This is iOS UI Kit behavior, please see [this].(https://developer.apple.com/documentation/uikit/uinavigationcontroller) for more information. Also, you should not post token or any secret keys while sharing the code in a public place. Please let me know if you have any questions. |
Hi @piyushtank
Yes, when press back, ViewController2 gets destroyed. But the room is owned by CallManager and while coming back again to the ViewController2, I am getting the same instance of Room( Please guide me how to access other features of the app during video call and while coming back to the video call screen, everything work fine. |
@pooja816 Correct, I also noticed that the Room is stored in CallManager. Unfortunately, SDK does not allow resetting the I have fixed the app to access other features of the app during video call and while coming back to the video call screen. See this. Let me know if you have any questions. |
@piyushtank Thanks. It is working fine. |
Sorry to dig up an old issue, but is there any way, or future plans, to support |
Hi @KrisConrad, We don't have a solution to this one at the moment. The problem is that Ideally, apple would extend Regards, |
Closing, as supporting PiP isn't on our roadmap for 2020. If Apple offers improved support for |
I reported FB7747223 to apple (on feedbackassistant.apple.com):
|
Thanks! If Apple accepts my lab appointment for tomorrow I will mention your feedback. |
@ceaglest Does ios14 change anything here? Or just bring the iPad functionality to the iPhone? We would be interested in putting video calls into PIP. |
@mcorner It looks like PiP functionality is coming to the iPhone but with the same constraint of the content being an AVPlayerLayer. I will be in the AVFoundation lab later today to discuss it with Apple. If you constrain a Room to use H.264 then any of the video content could in theory be played by an AVPlayer if it were remuxed to a transport stream and provided to an AVAsset with a custom protocol. It's just in memory copies but the delay might be too much for this technique to work. Edit: I am speaking about private Video APIs where I have access to the decrypted H.264 NALUs before they are decoded to a CVPixelBuffer. There aren't public APIs at this moment, but imagine a Renderer that receives CMSampleBuffers. |
It is apparently unimplemented in tvOS 15 Beta 1. |
@tmm1 |
Most of the discussion about Picture in Picture is about video playback services like Youtube and Netflix, but I'm more interested in Picture in Picture mode for calling apps like Facetime. There are two points I'm interested in. |
If Twitch and Netflix can support Picture in Picture mode, but other video calling apps can't, is it because they're not allowed by Apple? Or is it just a lack of resources? |
You can check some Apple documentation on it here! |
Hi, Seeing if I can answer some questions since I attended the AVKit lab during WWDC.
@Derad6709 is correct, you should take a look at the docs for iOS 15.0-beta1. In previous versions of iOS use of the camera in a multi-tasking environment was allowed but the entitlement was not documented anywhere. Apps like Netflix could use AVPlayer in PiP to play streaming video but even in the best possible scenario the delay was ~1s or more making it infeasible for live conferencing.
It looks like the AVPictureInPictureVideoCallViewController API for PiP is only available in iOS 15 but multi-tasking with the camera has been available as an undocumented API / entitlement on iPadOS 14.
Yes, but the approach you use will depend on if your app is using PiP for playback only (which won't require a new entitlement), or while running the camera.
Since you provide the UI with Best, |
@Derad6709 @ceaglest
Do you think it would be difficult to implement on iOS15 or earlier (e.g. iOS14)?
Is it the video that is delayed? Does the audio itself have a delay?
I would like to know what the approach will be in our case. Our case is not a video playback service, but a calling service. Since it is a call, the screen is basically never stopped. It is always live. In this case, which applies and what would be the approach? Is it the latter? |
Multitasking camera documentation (including usage of the camera in background while pip?) is here.
|
@Derad6709 @ceaglest |
@ceaglest |
@pooja816 Are you able to do that ? |
Hi all, Thanks for your patience, and all the suggestions. We have just shipped TwilioVideo 5.3 with Picture-in-picture support. Here is the changelogs. Try it out and let us know if you have any questions. Best, |
Hi @piyushtank, PiP for video calls was introduced in iOS 15 by using the entitlement Since iOS 16, PiP is generally available via the property AVCaptureSession.isMultitaskingCameraAccessEnabled. This means that, starting with iOS 16, we no longer need Apple's approval to use PiP, so I would like to use PiP only on iOS 16 and above. Would it be possible for Twilio Video to expose a boolean to enable/disable PiP by setting AVCaptureSession.isMultitaskingCameraAccessEnabled in the Thanks |
Hi, I tried this with my iphone ios 16, but ismultitaskingcamerasupport return false, does it only support ipad? |
@4brunu Thanks! TwilioVideo SDK doesn't do anything with PiP and multi-tasking enablement, its apps responsibility. TwilioVideo provides a renderer which could be used to render video frames using PiP view controller. Our VideoApp demonstrates how to use PiP renderer in an app - https://github.com/twilio/twilio-video-app-ios. S, as of now, we don't see a need for adding an API for AVCaptureSession.isMultitaskingCameraAccessEnabled. @fukemy iPhone 16 supports picture in picture. |
Hi @piyushtank, thanks for the fast response. I understand what you are saying, but there are two ways of enabling PiP:
Honestly having to ask Apple permission to use PiP is a bit cumbersome. |
hi @piyushtank , please tell me if my code is wrong, tested with Iphone 11 promax IOS 16
here is my log: |
@4brunu Thanks for the suggestions. We can open a new API for @fukemy Sounds like you have a custom capturer implementation. I am not sure why |
I ran the video app on my iPhone 13 mini, and it seems like multitasking camera functionality is not supported. When I background the application during a video call, the local video track is paused and doesn't resume until the app is brought back into the foreground (I've uploaded a screen recording ). There is no |
@Chandlerdea Thanks for reaching out. We are planning to add support in short term, mostly this quarter. |
Update: I wanted to reach out to to confirm that the suggested enhancement is under development. While developing the enhancement, we figured that, even though the Thanks! |
I have implement the video call in PIP but Once i go to the background video is not showing so How can i continue the video call in background for now? |
We have implemented twilio as a major feature for our app, But due to this feature we are stuck at a very crucial stage. Please let us know |
Support for PIP mode in iOS
Please add support for PIP mode in iOS
Expected Behavior
When any video call is in process, in between I also want to access other features of the app e.g. - WhatsApp video call
Actual Behavior
When I try to access other features of the app during call, I need to disconnect the call
Video iOS SDK
1.3.4 via CocoaPods
Xcode
9.2
iOS Version
10.0
iOS Device
iPhone 7
The text was updated successfully, but these errors were encountered: