A SwiftUI framework which makes it easy to integrate Video Call and Chat within a few lines of code.

Last update: Jul 25, 2022

Welcome to iStream!

This SwiftUI Framework allows you to add Video Call and Chat to your project within a few lines of code. To use this Framework, you'll need an iOS 15 project. Currently, only Azure Communication Services with a AWS Amplify S3 storage is supported by the framework, but in the future other options are planned.

Installation

To use the framework via Cocoapods, add the following line to your Podfile:


pod iStream, "~> 0.2.0"

Prerequisites

To use the Video Call and Chat feature, you have to create an Azure Communication Services resource. All information you need for the setup can be found here.

Video Call

For the Video Call feature, you'll also need an active Azure Notification Hub resource, which will be used to send and receive push notifications. For the ANH resource you'll need an active Apple Developer Program profile. All infos for the ANH resource can be found here

Note: Make sure to use option 2 with a .p8-Certificate, since only token based authentication will work for the push notifications.

Chat

For the Chat feature, you'll need an active AWS subscription, so the cloud storage for files can be configured. To setup Amplify for your app, follow these instructions:

  1. Navigate in your Xcode project

  2. Configure amplify for your project with:


amplify init

  1. Follow the instructions for the initialization

  2. Add storage to your project with:


amplify add storage

  1. Follow the instructions

  2. After the storage is setup push the changes to the cloud with:


amplify push

  1. Done!

Usage

Video Call

First, import the framework module inside your <YourApp>App.swift:


import iStream

Declare and initialize the CallingViewModel in your <YourApp>App.swift with the following code piece:


@StateObject var callingViewModel: CallingViewModel = CallingViewModel(callingModel: AzureCallingModel())

Then add the viewmodel as an environment object on your root view:


.environmentObject(self.callingViewModel)

After the Viewmodel is initialized, you have to setup the Viewmodel with the initCallingViewModel(identifier:displayName:token:) function. To generate an identifier and a token for the ACS resource, you can use the Azure plattform or implement an own server. Infos about implementing an own server can the found here.

After your viewmodel is initialized, you're ready to make some Video Calls. To start a call, use the self.callingViewModel.startCall(identifier:) function of the CallingViewModel, where identifiershould be an existing identifier from your ACS resource. The property presentCallView: Bool in CallingViewModel is set to true when a call successfully started. With this info, you can use the CallView view, to display the UI. If you want to add custom buttons in the CallView, you can add them in the initializer. Alternative you can implement own Views to display the UI by using the CallingViewModel instance.

Note: The CallView should get the viewmodel passed as an environmentObject with .environmentObject(self.callingViewModel).

Chat

To use the Chat feature, import the framework module in your <YourApp>App.swift file:


import iStream

After that, declare and initialize the ChatViewModel...


@StateObject var chatViewModel: ChatViewModel = ChatViewModel(chatModel: AzureChatModel())

... and pass it ass an environmentObject on your root view:


.environmentObject(self.chatViewModel)

To use the Viewmodel, initialize the chat feature with the self.chatViewModel.initChatViewModel(identifier:displayName:endpoint:token:) function. To generate an identifier and a token for the ACS resource, you can use the Azure plattform or implement an own server. Infos about implementing an own server can the found here. The endpoint parameter is the Endpoint from your ACS resource, which can be found under Settings > Keys in your resource infos in Azure portal.

After your viewmodel is setup, you can use the self.chatViewModel.startChat(with:partnerDisplayName:) function, where identifiershould be an existing identifier from your ACS resource. The chatIsSetup: Bool property is set to true when the chat view can be displayed. You can use this info to show the ChatView, to display the UI. If you want to add a custom message view, you can add it in the initializer. Alternative you can implement own Views to display the UI by using the ChatViewModel instance.

Note: The ChatView should get the viewmodel passed as an environmentObject with .environmentObject(self.chatViewModel).

GitHub

https://github.com/conrad030/iStream
You might also like...

A high-performance, flexible, and easy-to-use Video compressor library written by Swift.

FYVideoCompressor A high-performance, flexible and easy to use Video compressor library written by Swift. Using hardware-accelerator APIs in AVFoundat

Jul 22, 2022

High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

Aug 4, 2022

YHPlayer - An easy-to-use video player based on swift language

YHPlayer - An easy-to-use video player based on swift language

YHPlayer An easy-to-use video player based on swift language Features Plays loca

Feb 21, 2022

Swift Package used for video where I demonstrate how to extract a package to a local framework and modify it.

Swift Package used for video where I demonstrate how to extract a package to a local framework and modify it.

SegmentedPicker NOTE: This sample code is taken from the article by Frank Jia in his article titled Build a Custom iOS Segmented Control With SwiftUI

Oct 11, 2021

​ This framework allows developers to quickly manipulate audio and video splicing operations.

MTrack This framework allows developers to quickly manipulate audio and video splicing operations.We welcome your feedback in issues and pull requests

Nov 15, 2021

📹 Framework to Play a Video in the Background of any UIView

📹 Framework to Play a Video in the Background of any UIView

SwiftVideoBackground is an easy to use Swift framework that provides the ability to play a video on any UIView. This provides a beautiful UI for login

Jul 28, 2022

📽 A video player for SwiftUI, support for caching, preload and custom control view.

📽 A video player for SwiftUI, support for caching, preload and custom control view.

Features QuickStart Advances Installation Requirements License Demo Clone or download the project. In the terminal, run swift package resolve. Open Vi

Aug 5, 2022

Pretty iOS mobile screens + AVPlayer video view ––– made in SwiftUI

Pretty iOS mobile screens + AVPlayer video view ––– made in SwiftUI

UrbanVillageProjectScreens Recreated UI screens from the conceptual Urban Village Project. Read more about the project here. Please open an issue if y

Jun 13, 2022

VideoBackgroundSwiftUI - Video Background loop made with SwiftUI

VideoBackgroundSwiftUI - Video Background loop made with SwiftUI

VideoBackgroundSwiftUI (Updated) Video Background loop made with SwiftUI Video N

Aug 3, 2022
Related tags
Video mp4 record save display - How to Take , Save and Display a .mp4 Video

Technicalisto How to Take , Save and Display a .mp4 Video Add your design with v

Feb 20, 2022
A video composition framework build on top of AVFoundation. It's simple to use and easy to extend.
A video composition framework build on top of AVFoundation. It's simple to use and easy to extend.

A high-level video composition framework build on top of AVFoundation. It's simple to use and easy to extend. Use it and make life easier if you are implementing video composition feature.

Aug 2, 2022
A fully functional short video app project.Record a six secends video while playing prank sounds.

prankPro A fully functional short video app project How to Install 1. use coconapod to init your xcode environment. 2. change the app-keys in `applica

Jun 19, 2022
JDVideoKit - You can easily transfer your video into Three common video type.
JDVideoKit - You can easily transfer your video into Three common video type.

JDVideoKit Introduction You can easily transfer your video into Three common video type. You can use set up camera easily. Installation pod 'JDVideoK

Sep 9, 2021
A Swift library to upload video files to api.video platform.
A Swift library to upload video files to api.video platform.

api.video IOS video uploader api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and manag

Jan 10, 2022
api.video is the video infrastructure for product builders
api.video is the video infrastructure for product builders

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

Jun 27, 2022
Official SwiftUI SDK for Stream Chat.
Official SwiftUI SDK for Stream Chat.

SwiftUI - Currently in Development ?? The SwiftUI SDK is built on top of the StreamChat framework and it's a SwiftUI alternative to the StreamChatUI S

Aug 10, 2022
A video decoder built on ffmpeg which allows libpag to use ffmpeg as its software decoder for h264 decoding.

ffavc ffavc is a video decoder built on ffmpeg which allows libpag to use ffmpeg as its software decoder for h264 decoding. Build ffmpeg First, make s

Jun 3, 2022
Integrate Pianobar with the Now Playing feature of macOS
Integrate Pianobar with the Now Playing feature of macOS

PianobarNowPlayable - Integrate Pianobar with the Now Playing feature of macOS Ever wanted to control Pianobar like you do most other music applicatio

Feb 20, 2022
Valorem-demo - Demonstration code and video of Valorem, a bespoke portfolio recommendation platform to be created as an iOS mobile app.

valorem-demo Demonstration code of Valorem, a bespoke portfolio recommendation platform to be created as an iOS mobile app. The included code demonstr

Mar 4, 2022