GithubHelp home page GithubHelp logo

aws-samples / amazon-ivs-broadcast-for-ios-demo Goto Github PK

View Code? Open in Web Editor NEW
11.0 15.0 4.0 911 KB

This repository contains a broadcasting application for iOS. The app is built on Amazon IVS and uses the Amazon IVS Broadcast SDK to stream video from an iOS device to an Amazon IVS channel.

License: MIT No Attribution

Swift 99.82% Ruby 0.18%
ios ios-app ios-swift swift-ui broadcasting streaming livestream livestreaming aws amazon-ivs

amazon-ivs-broadcast-for-ios-demo's Introduction

Amazon IVS Broadcast for iOS Demo

This repository contains a demo app, which shows how to use the Amazon IVS Broadcast SDK to create a mobile streaming app on iOS using SwiftUI.

An iPhone with the demo application running on the screen.

Setup

  1. Clone the repository to your local machine.
  2. Ensure you are using a supported version of Ruby, as the version included with macOS is deprecated. This repository is tested with the version in .ruby-version, which can be used automatically with rbenv.
  3. Install the SDK dependency using CocoaPods. This can be done by running the following commands from the repository folder:
    • pod install
    • For more information about these commands, see Bundler and CocoaPods.
  4. Open Broadcasting.xcworkspace.
  5. Since the simulator doesn't support the use of cameras or ReplayKit, there are a couple changes you need to make before building and running the app on a physical device.
    1. Have an active Apple Developer account in order to build to physical devices.
    2. Modify the Bundle Identifier for both Broadcasting and ReplayKitBroadcaster targets.
    3. Choose a Team for both targets.
    4. Create a new App Group ID based on your new Bundle Identifier for both targets, and include the targets in only that App Group.
    5. Modify appGroupName (can be found in Helpers/Constants.swift) to use your newly created App Group ID.
  6. (Optional)* Refer to the Streaming to Amazon IVS section of this readme to set up the app for streaming.
  7. You can now build and run the projects on a device.

*You can run and build this app without an Amazon IVS Channel, but you will need an Amazon IVS Channel in order to start broadcasting.

Streaming to Amazon IVS

Prerequisites

IMPORTANT NOTE: Using your own stream will create and consume AWS resources, which will cost money.

  1. Create and set up an Amazon IVS channel. A guide is available here: Getting started with Amazon IVS.

Referencing your stream in the app

  1. Open the Amazon IVS Console and navigate to the channel you would like to use.
  2. Open Helpers/Constants.swift and find lines 16 - 18.
  3. Copy the Ingest Server for the channel and paste it into the ingestServer field on line 16 between the quotes. The resulting line should look like the following: static let ingestServer = "rtmps://<ingest_server_url>:443/app/"
  4. Copy the Stream Key for the channel and paste it into the streamKey field on line 17 between the quotes.
  5. Copy the Playback URL for the channel and paste it into the playbackUrl field on line 18 between the quotes.
  6. Save and run the application.

You can also change the values for any of these fields in the app settings once you have launched the app on a physical iPhone.

Known Issues

  • This app has only been tested on devices running iOS 14 or later. While this app may work on devices running older versions of iOS, it has not been tested on them.

More Documentation

License

This project is licensed under the MIT-0 License. See the LICENSE file.

amazon-ivs-broadcast-for-ios-demo's People

Contributors

amazon-auto avatar coelhor avatar dependabot[bot] avatar mboulin avatar muhfarsh avatar slee-aws avatar uldiszz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-ivs-broadcast-for-ios-demo's Issues

Streaming stops after the app entered background

Hi. I'm using this sample app and I've noticed that streaming stops when the app enters the background.
This seems to be unexpected behavior, because the app creates a background image before streaming in a method BroadcastViewModel.createAppBackgroundImageSource().

I believe the expected behavior is as follows:
When the app is in the background, it streams the static background image that is set up in BroadcastViewModel.createAppBackgroundImageSource().

Environment

Xcode: 14.2
iPhone 13 (physical device)
iOS 16.0

Demo app version

Latest commit in main branch: f3e3fad895694cc4254d333a625621c8be80c5a5

Amazon IVS SDK Version

AmazonIVSBroadcast 1.10.0

What I changed

  • Update signing.
  • Remove App group from Capabilities
  • Update ingest server and stream key (at line 16, 17 of Helpers/Constants.swift )

How to reproduce

  1. PC: Set ingest server and stream key in Helpers/Constants.swift.
  2. PC: Build the app.
  3. iPhone: Launch the app.
  4. iPhone: Start streaming by tapping the Start button.
  5. PC: Open playback URL to watch the stream.
  6. iPhone: Move the app to the background.

Result: The stream will stop after about 10 seconds.

What is unexpected?

Streaming stops after the app entered the background, as mentioned in How to reproduce.

What is expected?

  • The app will continue streaming when it's in the background.
  • The app will stream a static background image that is set up in BroadcastViewModel.createAppBackgroundImageSource(), while it's in the background

SPM support

Any plans to add SPM support for your SDK? Not having one is quite a big deal-breaker for us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.