This repository provides the iOS sdk version of the Zender Player.
Current version is 2.1.0
, target :ios 9.0 (PhenixSdk version 2019.2.1)
- Logging to the admin https://admin.zender.tv
- Select a specific stream
- Get the information (the I icon)
- Read the targetId and channelId
A sample project is provided in this repo Demo Project
- You'll need your targetId and channelId configured in the ViewController.m
- the project uses Cocoapods , so requires a
pod install
to install all the dependencies
//
// ViewController.m
// ZenderDemo
//
// Created by Patrick Debois on 30/06/2019.
// Copyright © 2019 Zender. All rights reserved.
//
#import "ViewController.h"
@import Zender;
@interface ViewController ()<ZenderPlayerDelegate>
@property (atomic, strong) ZenderPlayer *player; // ZenderPlayer is UIViewController
@property (atomic, strong) ZenderAuthentication *authentication;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Initialize the target and channel
NSString *channelId ;
NSString *targetId;
targetId = @"<your-target-id>"; // fill-in your own targetId
channelId = @"<your-channel-id>"; // fill-in your own channelId
// Create a Zender Player
self.player= [ZenderPlayer new];
// Create a player configuration
ZenderPlayerConfig* settingsConfig = [ZenderPlayerConfig configWithTargetId:targetId channelId:channelId];
self.player.config = settingsConfig;
[self setupAuthentication];
self.player.authentication = _authentication;
// Set this class as a ZenderPlayerDelegate
self.player.delegate = self;
self.player.view.frame = self.view.frame;
self.player.view.hidden = false;
[self.player start];
[self.view addSubview:self.player.view];
// Do any additional setup after loading the view, typically from a nib.
}
#pragma mark Zender Authentication
- (void)setupAuthentication {
// Configure authentication, uncomment depending on your configuration
/* No authentication
_authentication=nil;
*/
/* Device Authentication
_authentication = [ZenderAuthentication authenticationWith:@{
@"token": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
@"name": @"demo",
@"avatar": @"https://cdn.iconscout.com/public/images/icon/free/png-512/avatar-user-hacker-3830b32ad9e0802c-512x512.png"
} provider:@"device"];
*/
/* Facebook authentication , requires the facebook framework to be integrated
_authentication = [ZenderAuthentication authenticationWith:@{
@"token": [FBSDKAccessToken currentAccessToken].tokenString,
} provider:@"facebook"];
*/
/* Google authentication , requires the google framework to be integrated
_authentication = [ZenderAuthentication authenticationWith:@{
@"token": <googleToken>
} provider:@"google"];
*/
/*
_authentication = [ZenderAuthentication authenticationWith:@{
@"token": signed_json_string
} provider:@"signedProvider"];
*/
}
#pragma mark Zender Player Delegate
// Listen for player ready event
- (void)zenderPlayer:(ZenderPlayer *)zenderPlayer onZenderPlayerReady:(NSDictionary *)payload {
}
// Listen for player close event
- (void)zenderPlayer:(ZenderPlayer *)zenderPlayer onZenderPlayerClose:(NSDictionary *)payload {
// stop the player
[self.player stop];
self.player.delegate = nil;
self.player = nil;
}
// Listen for player logout event
- (void)zenderPlayer:(ZenderPlayer *)zenderPlayer onZenderPlayerAuthenticationLogout:(NSDictionary *)payload {
// stop the player
[self.player stop];
self.player.delegate = nil;
self.player = nil;
}
// Listen for player authentication required
- (void)zenderPlayer:(ZenderPlayer *)zenderPlayer onZenderPlayerAuthenticationRequired:(NSDictionary *)payload {
// do something to login the user
}
// Listen for Quiz Share codes
- (void)zenderPlayer:(ZenderPlayer *)zenderPlayer onZenderQuizShareCode:(NSDictionary *)payload {
// This will open up the native share window
[zenderPlayer sharePayload:payload controller:self];
}
@end
For a more detailed explantion on authentication see https://github.com/zendertv/zender-docs/blob/master/AUTH.md
The sdk is provided via private Cocoapod repository. Add the following to the top of your Podfile
source 'https://github.com/zendertv/Specs.git'`
source 'https://github.com/CocoaPods/Specs.git'
Add this pod :
# Pods for ZenderDemo
pod 'Zender'
Note: The pod downloads a large zip file containing the frameworks , this might take some time
A zip file containing the sdk frameworks can be downloaded from https://repo.zender.tv/ios/zender-ios-sdk-v2.1.0.zip
Note: the framework files are large, if you want to check them in you will require github Large File Support
The second step is to add the frameworks as embedded frameworks:
- Select your Application Target (on the left)
- Select the General tab
- Select Add the framework via the
Embedded Binaries
(+ button) - Select Other to add the framework
- Browse to your manually downloaded sdk file
- Add frameworks
Zender
,ZenderPhenix
andPhenixSdk
- When a screen pops up to 'Choose options for adding these files'
(Select Copy if needed)
Now add the necessary frameworks under "General/Linked Frameworks and Libraries":
- UIKit.framework
- JavascriptCore.framework
- AVFoundation.framework
- AVKit.framework
Zender depends on frameworks that are currrently not BITCODE enabled. Therefore you need to disable it:
- Select your Application Target (on the left)
- Select the
Build Settings
tab - Find
Enable Bitcode
and select NO
To be able to play audio in background, add this to the background mode:
- Select your Application Target (on the left)
- Select the
Capabilities
tab - Select
Audio, Airplay, and Picture in Picture
The Zender player autorotates, if you don't want this behaviour you need to fix the app rotation or the controller
- Select your Application Target (on the left)
- Select the
General
tab - Select/Deselect the required
Device Orientation
options
On iPad screens can be viewed in split screen , it's best to disable that
The Zender frameworks provides armv7, arm64, x86_64
architecture builds.
To publish an app to the appstore, you need to strip the simulator part.
The Zender Admin console provides a way to send push notifications to users to notifiy them when new streams are available. This requires push notification certificate setup to match the bundleId of your app and allowing us to send the push notifications.
Just add the following part to your AppDelegate.m
@import Zender;
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[Zender sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
Zender supports using Universal Deeplinks. The default zender domain is links.zender.tv . To make this work, the AppId needs to be configured in the backend.
Add links.zender.tv
under your domains.
Just add the following code so Zender handles the deeplinks
@import Zender;
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
BOOL handled = [[Zender sharedInstance] handleUniversalLink:userActivity.webpageURL completion:^(NSError *error) {
}];
return handled;
}
More advanced topics are described at Advanced Documentation
Since version 2.0.0 a lot has changed , but you can still read the Version 1 Documentation
We adhere to the Semantic Versions scheme to indiciate releases. Versions starting with 0.x should be considered beta versions and not yet ready for production use.
Before using people their name, avatar and other information, they should give a consent to use their data. It is up the implementor of the SDK to get the agreement of the user before exposing him in the Zender Player.
The data is securely stored on the Zender platform but there needs to be an agreement
- All Zender Code is copyrighted and owned by Small Town Heroes BVBA. Extensions have their own license based on the license of the supplier.
- This code does not grant you ownership or a license to use it. This needs to be arranged by a specific license agreement.
- All code provided should be treated as confidential until official cleared.
See Changelog