Swift

Setting Up Authentication

In order to connect to a Vonage Video session, the client will need access to some authentication credentials — an application ID, session ID, and token. In a production application, these credentials should be generated by a Server SDKs, but to speed things up we will hard code the values for now:

  1. Start by copying the following code block and adding it to your VonageVideoManager.swift file:
// Replace with your Vonage Video APP ID
let kAppId = ""
// Replace with your generated session ID
let kSessionId = ""
// Replace with your generated token
let kToken = ""

Add these lines right at the start of the class VonageVideoManager declaration.

  1. Adjust the code by hard coding the values for the kAppId, kSessionId and kToken. You can obtain them by following the instructions below:

Note: In production applications, they are retrieved from the server more info. For this demo, you can either deploy a Video Learning Server (Node or PHP) and set serverURL or follow the next steps to generate and hardcode them. To get the credentials needed to run the demo:

  • Sign up for or Log into your account.
  • In the left-side menu of the dashboard, click Applications and select a previous application or create a new one to view the Application ID. Screenshot of dashboard with Applications highlighted
Screenshot of dashboard with Application ID highlighted
  • Make sure that Video is activated
Screenshot of dashboard with Video section highlighted
  • Head over to the The Video API Playground. Either enter the Application ID or find it in the dropdown. You can leave the default values for the other options. Click "Create".
Screenshot of The Video API Playground tool
  • Your Session ID and Token will be created.
Screenshot of The Video API Playground tool generated details with the Application ID, Session ID, and Token highlighted in red boxes

Important: You can continue to get the session ID and token values from your Account during testing and development, but before you go into production you must set up a server.

For more information on sessions, tokens, and servers, check out Video API Technical Details.

Custom audio driver

Learn how to use a custom audio driver to customize publisher and subscriber stream audio. You will use the custom audio driver when you want to start and stop the audio, and play your own audio file. When you want to do "anything" with audio, other than the SDK default behavior of live video chat, you would use custom audio drivers.

Available on:
Swift
Steps
1
Introduction
2
Getting Started
3
Creating a New Project
4
Adding the Vonage Video SDK
5
Setting Up Authentication
6
Overview
7
Create the Custom Audio Driver Class
8
Implement the "Play Ringtone" Logic
9
Implement the "Stop Ringtone" Logic
10
Integrate with Vonage Video Manager
11
Control audio via Session Events
12
How It Works
13
Conclusion