Swift

Getting Started

  1. In the target’s General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
  2. import THEOplayerSDK in your view controller
  3. Declare a player variable
var player = THEOplayer()
  1. Position and size your player
player.frame = CGRect(x: 0, y: 0, width: 320, height: 180)
  1. Add the player to your controller’s view hierarchy
player.addAsSubview(of: controller.view)

Set a Media Source

Create a SourceDescription object and set the player’s source

let source = SourceDescription(sources: TypedSource(src: "https://www.examples.com/index.m3u8", type: "application/x-mpegurl"))
player.source = source

Objective-C

Getting Started

  1. In the target’s General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
  2. #import <THEOplayerSDK/THEOplayerSDK-Swift.h> in your view controller
  3. Declare a player variable
THEOplayer *player =  [[THEOplayer alloc] initWithConfiguration:nil];
  1. Position and size your player
[player setBounds:CGRectMake(0, 0, 320, 180)];
CGSize screenBounds = UIScreen.mainScreen.bounds;
[player setCenter:CGPointMake(screenBounds.width/2, screenBounds.height/2)];
  1. Add the player to your controller’s view hierarchy
[player addAsSubviewOf:controller.view];

Set a Media Source

Create a SourceDescription object and set the player’s source

TypedSource *typedSource = [[TypedSource alloc] initWithSrc:@"https://www.examples.com/index.m3u8" type:@"application/x-mpegurl"];
SourceDescription *source = [[SourceDescription alloc] initWithSources:typedSource ads:NULL textTracks:NULL poster:NULL analytics:NULL metadata:NULL];
player.source = source;