GetStream / stream-video-swift

SwiftUI Video SDK ➡️ Stream Video 📹
https://getstream.io/video/sdk/ios/
Other
111 stars 21 forks source link

Display camera feed without creating a call #489

Closed andreasteich closed 2 weeks ago

andreasteich commented 3 weeks ago

What are you trying to achieve?

I want to display the camera feed without actually creating a call.

If possible, how can you achieve this currently?

Maybe possible, but I can't find any information after several hours reading the docs.

What would be the better way?

Update the docs if possible yet, otherwise would be a great feature to use!

ipavlidakis commented 3 weeks ago

Hey @andreasteich,

Thanks for reaching out. Do you mind elaborating more on your use case?

Best regards, Ilias

andreasteich commented 3 weeks ago

Hey @ipavlidakis, thanks for replying so quick!

Yes, of course! I'm trying to create an application using AVFoundation, the Vision framework for image analysis, and WebRTC. Since this is initially a prototype and the GetStream SDK seemed very flexible for these purposes, I decided to use GetStream. Now, I would like to achieve the following:

As soon as the user opens the application and is authenticated, I want to display the live camera feed, where individual frames can already be analyzed by the Vision framework and react to given observations. For example, if the user wants to record the camera feed and include the observations that were drawn onto the image.

Unfortunately, this would mean that at this point and during the "camera preview," there would be no active call yet. Of course, it would be possible to cover this use case with a separate view that only uses AVFoundation and the Vision framework, and then swap this view with the GetStream SDK logic once the user starts a call. However, this seems unnecessarily complicated to me.

For this reason, I am wondering if it is possible to implement a camera preview using the GetStream SDK, where the video filters that are normally applied during a call could already be applied.

I hope this explains my use case more clearly.

andreasteich commented 3 weeks ago

That's the best example I've found. This view looks to like it's possible to show the camera feed before joining or starting a call. I'm wondering how that's possible using the swift SDK.

Bildschirmfoto 2024-08-22 um 10 18 41

andreasteich commented 2 weeks ago

@ipavlidakis any news?

ipavlidakis commented 2 weeks ago

Hey @andreasteich

Sorry for the delay. The page you sent me is also implemented on the iOS SDK under the name LobbyView. We also have some related documentation that can be find here.

The way it works is by using the local track that is being created and render it using our VideoRenderer component.

Best regards, Ilias

andreasteich commented 2 weeks ago

No problem, thank you very much for the information! I already tried to implement this kind of view, but couldn't get it to work cause of no active call that was present at this time. Maybe I did something wrong. I'll give the LobbyView another try.

Do you have a link to a repository where I can find an example for that in iOS? I don't know how to get the callSettings initialized which get passed to the LobbyView via @Binding.

ipavlidakis commented 2 weeks ago

The CallSettings is a simple object that you can initialise from anywhere, so that shouldn't be a problem for now (the LobbyView only requires a binding to CallSettings as it changes them.).

Do you have a link to a repository where I can find an example for that in iOS The repository we are currently discussing on :).

The file I shared earlier, is the actual View we are using in our DemoApp (which you build by checking out this repo of course).

I'm going to close this ticket for now but please feel free to reopen if you keep facing issues or let us know on a new issue.

Best regards, Ilias

andreasteich commented 6 days ago

Hey @ipavlidakis ,

sry I'm not able to reopen this issue, but I think I have to. Got it working to show a custom Lobby View and now I can preview the video footage as expected, thank you very much 🙏🏻

My last question is: is it possible to set video filters for lobby preview as well? Currently I'm achieving this using call.setVideoFilter(Filters.stream) but I have no call object available yet. Is that possible via the LobbyViewModel as well?

I'll make a new issue for that, has nothing to do directly with CustomLobbyView. Thank you very much!