Basic embedding

Brid SDK Integration

BridSDK gives you the factory methods to pair the player with your player id that you set up in BRID CMS. Each Player (BVPlayer), is created with the help of your credentials (which includes the ID of your player, playlist ID etc. BVPlayer replace created AVPlayerViewController you have at your disposal, it is now on you to:

  1. Declare AVPlayerViewController and BVPlayer object
  2. Setup a BVObject data object where you can configure a BVPlayer instance using your credentials

Type of Brid Data

Player with single video

#import "ViewController.h"
#import <BridSDK/BridSDK.h>
  
@interface ViewController ()

@property (nonatomic) BVPlayer *player;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    AVPlayerViewController *playerController = [[AVPlayerViewController alloc] init];
  
    //init player
    _player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forVideoID:<int>] forAvController:playerController];
  
    //present player
    [self presentViewController:playerController animated:YES completion:nil];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:true];
    _player = nil;
}

@end
import UIKit
import BridSDK

class ViewController: UIViewController {
    
    var player: BVPlayer?
    var playerController: AVPlayerViewController?

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.playerController = AVPlayerViewController.init()
      
        //init player
        player = BVPlayer(data: BVData(playerID: 24282, forVideoID: 442011), forAvController: self.playerController)
      
        //present player
        self.present(playerController!, animated: true, completion: nil)    
    }
  
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        player = nil
    }

}

Player with playlist

#import "ViewController.h"
#import <BridSDK/BridSDK.h>
  
@interface ViewController ()

@property (nonatomic) BVPlayer *player;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    AVPlayerViewController *playerController = [[AVPlayerViewController alloc] init];
  
    //init player
    _player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forPlaylistID:<int>] forAvController:playerController];
  
    //present player
    [self presentViewController:playerController animated:YES completion:nil];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:true];
    _player = nil;
}

@end
import UIKit
import BridSDK

class ViewController: UIViewController {
    
    var player: BVPlayer?
    var playerController: AVPlayerViewController?

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.playerController = AVPlayerViewController.init()
      
        //init player
        player = BVPlayer(data: BVData(playerID: Int32, forPlaylistID: Int32), forAvController: self.playerController)
      
        //present player
        self.present(playerController!, animated: true, completion: nil)    
    }
  
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        player = nil
    }

}

Player with playlist by channel and option from what page and how many to load

#import "ViewController.h"
#import <BridSDK/BridSDK.h>
  
@interface ViewController ()

@property (nonatomic) BVPlayer *player;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    AVPlayerViewController *playerController = [[AVPlayerViewController alloc] init];
  
    //init player
    _player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forChanneltID:<int> page:<int> item:<int>] forAvController:playerController];
  
    //present player
    [self presentViewController:playerController animated:YES completion:nil];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:true];
    _player = nil;
}

@end
import UIKit
import BridSDK

class ViewController: UIViewController {
    
    var player: BVPlayer?
    var playerController: AVPlayerViewController?

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.playerController = AVPlayerViewController.init()
      
        //init player
        player = BVPlayer(data: BVData(playerID: Int32, forChanneltID: Int32, page: Int32, item: Int32), forAvController: self.playerController)
      
        //present player
        self.present(playerController!, animated: true, completion: nil)    
    }
  
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        player = nil
    }

}

Player with latest videos playlist and option from what page and how many to load

#import "ViewController.h"
#import <BridSDK/BridSDK.h>
  
@interface ViewController ()

@property (nonatomic) BVPlayer *player;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    AVPlayerViewController *playerController = [[AVPlayerViewController alloc] init];
  
    //init player
    _player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forLatestID:<int> page:<int> item:<int>] forAvController:playerController];
  
    //present player
    [self presentViewController:playerController animated:YES completion:nil];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:true];
    _player = nil;
}

@end
import UIKit
import BridSDK

class ViewController: UIViewController {
    
    var player: BVPlayer?
    var playerController: AVPlayerViewController?

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.playerController = AVPlayerViewController.init()
      
        //init player
        player = BVPlayer(data: BVData(playerID: Int32, forLatestID: Int32, page: Int32, item: Int32), forAvController: self.playerController)
      
        //present player
        self.present(playerController!, animated: true, completion: nil)    
    }
  
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        player = nil
    }

}

Player with a video by tag playlist, it loads video with tag string and option from what page and how many to load

#import "ViewController.h"
#import <BridSDK/BridSDK.h>
  
@interface ViewController ()

@property (nonatomic) BVPlayer *player;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    AVPlayerViewController *playerController = [[AVPlayerViewController alloc] init];
  
    //init player
    _player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forTag:<String> page:<int> item:<int>] forAvController:playerController];
  
    //present player
    [self presentViewController:playerController animated:YES completion:nil];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:true];
    _player = nil;
}

@end
import UIKit
import BridSDK

class ViewController: UIViewController {
    
    var player: BVPlayer?
    var playerController: AVPlayerViewController?

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.playerController = AVPlayerViewController.init()
      
        //init player
        player = BVPlayer(data: BVData(playerID: Int32, forTag: String, page: Int32, item: Int32), forAvController: self.playerController)
      
        //present player
        self.present(playerController!, animated: true, completion: nil)    
    }
  
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        player = nil
    }

}

📘

Explanation

Every time the player is initialized internal observers are subscribed. If ad started and user exit (using remote control) the current player, observers will remain live because ad controller is holding the reference of AvPlayerController view. To avoid disruption of the app and any potential errors please set player to nil in a viewWillAppear


Did this page help you?