Skip to content

UIKit for iOS app developers to build real-time straming applications using Dolby.io real-time streaming API

License

Notifications You must be signed in to change notification settings

DolbyIO/rts-uikit-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dolby.io Real-time Streaming UIKit for iOS

Overview

The Dolby.io Real-time Streaming UIKit for iOS is designed to help iOS developers reduce the complexity of building a Dolby.io Real-time Streaming (RTS) monitor applications for iOS.

This package consists of three kinds of components:

  • DolbyIORTSUIKit: The high-level UI components that can be used to develop a real-time streaming monitoring app for iOS with Dolby.io.
  • DolbyIORTSCore: The logic between DolbyIORTSUIKit and Dolby.io Real-time Streaming iOS SDK.
  • DolbyIOUIKit: The basic UI components used by DolbyIORTSUIKit.

Note: There are two parties in RTS - a publisher and a viewer. A publisher is one who broadcasts the stream. A viewer is one who consumes the stream. This UIKit is meant for viewer/monitor applications. Please refer to this blog post to understand the ecosystem.

Requirements

This setup guide is validated on both Intel and Apple Silicon based MacBook Pro machines running macOS 13.4.

  • Xcode Version 14.3.1 (14E300c)
  • iPhone device or simulator running iOS 15.0
  • Familiarity with iOS development using Swift and Swift UI

Getting Started

This guide demostrates how to use the RTS UI components to quickly build a streaming monitor app for iOS devices.

Build a Sample App

To get started with building your own app with the RTS UI kit, see below.

  • Create a new Xcode project.
  • Choose the iOS App as template.
  • Fill in the Product Name.
  • Select "SwiftUI" as Interface.
  • Select "Swift" as Language.
  • Create the project in a folder.
  • Add this UIKit as dependencies to the newly created project.
    • Go to File > Add Package.
    • Put the URL of this repo in the pop-up window's top-right corner text field.
    • Use Up to Next Major Version in the Dependency Rule.
    • Click the Add Package button.
    • Choose and add these packages DolbyIORTSCore, DolbyIORTSUIKit, and DolbyIOUIKit to the target.
    • Click the Add Package button.
  • Copy and replace the code in ContentView.swift with the code snippet below.
  • Compile and Run on an iOS target.
import SwiftUI

// 1. Include Dolby.io UIKit and related packages
import DolbyIORTSCore
import DolbyIORTSUIKit

struct ContentView: View {
    // 2. State to show if the stream is live or not
    @State private var showStream = false

    var body: some View {
        NavigationView {
            ZStack {
                
                // 3. Navigation link to the streaming screen if `showStream` is true
                NavigationLink(destination: StreamingScreen(isShowingStreamView: $showStream), isActive: $showStream) { EmptyView() }
                Button ("Start Stream") {
                
                    // 4. Async task connects the viewer with the given stream name and account ID. The stream name and 
                    // account ID pair here is from a demo stream. It can be replaced by a pair being given by a publisher who has 
                    // signed-up up to the Dolby.io service. See the next section below to set up your own streams.
                    Task {
                        let success = await StreamOrchestrator.shared.connect(streamName: "simulcastmultiview", accountID: "k9Mwad")
                        
                        // 5. Show the real-time streaming if connect successfully
                        await MainActor.run { showStream = success }
                    }
                }
            }.preferredColorScheme(.dark)
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

This app has a Start stream button which starts playing a demo stream in the app. The streaming screen contains all the components you need to build your experience - including a settings menu where you can select different video layouts, audio source selection, and stream sort order.

Sign up for a Dolby.io account

A Dolby.io account is necessary to publish your own RTS stream. To set up your Dolby.io account, go to Dolby.io dashboard and complete the form. After confirming your email address, you will be logged in.

Installation

This UIKit package uses Swift Packages. You can add this package site URL as a dependency in your app. Details can be found here

Info: The main branch is constantly under active development. Get a tagged branch for a stable release.

Starting your own stream

To start your own video stream broadcast using the Dolby.io dashboard, see this guide. To set up your own stream that can be consumed in this app, follow this guide and copy over the stream name and stream ID into the app.

License

The Dolby.io Real-time UIKit for iOS and its repository are licensed under the MIT License. Before using this, please review and accept the Dolby Software License Agreement.

About Dolby.io

Using decades of Dolby's research in sight and sound technology, Dolby.io provides APIs to integrate real-time streaming, voice & video communications, and file-based media processing into your applications. Sign up for a free account to start building the next generation of immersive, interactive, and social apps.

© Dolby, 2023

           
      Dolby.io on YouTube       Dolby.io on Twitter       Dolby.io on LinkedIn

About

UIKit for iOS app developers to build real-time straming applications using Dolby.io real-time streaming API

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages