Swift
Getting Started
- In the target’s General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
import THEOplayerSDK
in your view controller- Declare a player variable
var player = THEOplayer()
- Position and size your player
player.frame = CGRect(x: 0, y: 0, width: 320, height: 180)
- 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
- In the target’s General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
#import <THEOplayerSDK/THEOplayerSDK-Swift.h>
in your view controller- Declare a player variable
THEOplayer *player = [[THEOplayer alloc] initWithConfiguration:nil];
- 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)];
- 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;