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 places itself within the Container view you have at your disposal, which is basically a UIView, it is now on you to:
- Setup a BVObject data object where you can configure a player instance using your credentials
- Give it a container view in which to display them
The container view (UIView) by itself will retain the @weak reference of BVPlayer view but not BVPlayer itself which in addition to the view contains logic and networking so the player will not work unless stored as a @strong reference.
Example 1:
If you have one container view that is not reusable, create one variable
Example 2:
If you have reusable viewers (UITableView, UICollectionView), create an array var player: [BVPlayer] in which you save the players and in each preparation of a new reusable cell (UITableCell) re-adjust the view from the player list
//Example 1
@property (nonatomic) BVPlayer *player;
//Example 2
@property (nonatomic) <BVPlayer *> *player;
//Example 1
var player: BVPlayer?
//Example 2
var player: [BVPlayer]?
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];
player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forVideoID:<int>] forView:<UIView>]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
player = BVPlayer(data: BVData(playerID: <Int32>, forVideoID: <Int32>), for: <UIView>)
}
}
Player with playlist
#import "ViewController.h"
#import <BridSDK/BridSDK.h>
@interface ViewController ()
@property (nonatomic) BVPlayer *player;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forPlaylistID:<int>] forView:<UIView>]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
player = BVPlayer(data: BVData(playerID: Int32, forPlaylistID: Int32), for: <UIView>)
}
}
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];
player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forChanneltID:<int> page:<int> item:<int>] forView:<UIView>]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
player = BVPlayer(data: BVData(playerID: Int32, forChanneltID: Int32, page: Int32, item: Int32), for: <UIView>)
}
}
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];
player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forLatestID:<int> page:<int> item:<int>] forView:<UIView>]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
player = BVPlayer(data: BVData(playerID: Int32, forLatestID: Int32, page: Int32, item: Int32), for: <UIView>)
}
}
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];
player = [[BVPlayer alloc] initWithData:[[BVData alloc] initPlayerID:<int> forTag:<String> page:<int> item:<int>] forView:<UIView>]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
player = BVPlayer(data: BVData(playerID: Int32, forTag: String, page: Int32, item: Int32), for: <UIView>)
}
}
Player with custom single video object:
#import "ViewController.h"
#import <BridSDK/BridSDK.h>
@interface ViewController ()
@property (nonatomic) BVPlayer *player;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//Create video object
Source *source = [[Source alloc] init];
source.sd = @"<yourVideoUrl>"
VideoData *videoObject = [[VideoData alloc] initWithVideo:<videoID> duration:"<durationVideo>" ageGateId:nil name:"nameOfVideo" _description:"<decription>" image:"<image>" thumbnail:"<imageThumbnail>" clickthroughUrl:nil thumb:<"<imageThumb>"> publish:nil mimeType:nil webp:nil monetize:nil liveimage:nil secureUrl:nil source:source traxcks:nil];
//Init player
player = [[BVPlayer alloc] singleVideo:<videoObject> layerID: <playerID>, for: <yourView]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
//Create video object
let source = Source()
source.sd = "<yourVideoUrl>"
var montizeValue: ObjCBool = true
let videoObject = VideoData(video: <videoID>, duration: "<durationVideo>", ageGateId: nil, name: "nameOfVideo", _description: "<decription>", image: "<image>", thumbnail: "<imageThumbnail>", clickthroughUrl: nil, thumb: "<imageThumb>", publish: nil, mimeType: nil, webp: nil, monetize: &montizeValue, liveimage: nil, secureUrl: nil, source: source, tracks: nil)
//Init player
player = BVPlayer(singleVideo: videoObject, playerID: <playerID>, for: <yourView>)
}
}
Player with custom playlist video objects:
#import "ViewController.h"
#import <BridSDK/BridSDK.h>
@interface ViewController ()
@property (nonatomic) BVPlayer *player;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//Create video objects
Source *source = [[Source alloc] init];
source.sd = @"<yourVideoUrl>"
VideoData *videoObject = [[VideoData alloc] initWithVideo:<videoID> duration:"<durationVideo>" ageGateId:nil name:"nameOfVideo" _description:"<decription>" image:"<image>" thumbnail:"<imageThumbnail>" clickthroughUrl:nil thumb:<"<imageThumb>"> publish:nil mimeType:nil webp:nil monetize:nil liveimage:nil secureUrl:nil source:source traxcks:nil];
NSMutableArray<VideoData *> *arrayVideo = [[NSMutableArray alloc] init];
[arrayVideo addObject:videoObject];
//Init player
player = [[BVPlayer alloc] playlist:arrayVideo layerID: <playerID>, for: <yourView]
}
@end
import UIKit
import BridSDK
class ViewController: UIViewController {
var player: BVPlayer?
override func viewDidLoad() {
super.viewDidLoad()
//Create video objects
let source = Source()
source.sd = "<yourVideoUrl>"
var montizeValue: ObjCBool = true
let videoObject = VideoData(video: <videoID>, duration: "<durationVideo>", ageGateId: nil, name: "nameOfVideo", _description: "<decription>", image: "<image>", thumbnail: "<imageThumbnail>", clickthroughUrl: nil, thumb: "<imageThumb>", publish: nil, mimeType: nil, webp: nil, monetize: &montizeValue, liveimage: nil, secureUrl: nil, source: source, tracks: nil)
var arrayVideo = [VideoData]()
arrayVideo.append(videoObject)
//Init player
player = BVPlayer(playlist: arrayVideo, playerID: <playerID>, for: <yourView)
}
}
Updated almost 2 years ago