IOS SDK API Reference

Single video

player = [[BVPlayer alloc] initWithData: [[BVData alloc] initPlayerID:@”” forVideoID:@””] forView: <view>];

Playlist

ByTag

player = [[BVPlayer alloc] initWithData: [[BVData alloc] initPlayerID:@”” forTag: @””  page:@”” item:@””] forView: <view>];

By Playlist ID

player = [[BVPlayer alloc] initWithData: [[BVData alloc] initPlayerID:@”” forPlaylistID:@””] forView: <view>];

Latest

player = [[BVPlayer alloc] initWithData: [[BVData alloc] initPlayerID:@”” forLatestID:@””] forView: <view>];

By Channel

player = [[BVPlayer alloc] initWithData: [[BVData alloc] initPlayerID:@”” forLatestID:@””] forView: <view>];

Methods

Play

Start video playback

[player play];

Pause

Pause video playback

[player pause];

Mute

Mute video.

[player mute];

Unmute

Unmute video.

[player unmute];

Previous

Play previous video in playlist

[player previous];

Next

Play next video in playlist.

[player next];

Stop

Stop playback.

[player stop];

Getters

isFullscreen

Is video fullscreen.

Code Return
[player isFullscreen] Boolean (0,1)

isPlayerInView

Is the player in View of Window or Superview, is the window hidden, or the player or superview, is it inside the bounds of the Window or Superview frame, is there any view in front of him and if they are overlaping.

Code Return
[player isPlayerInView] Boolean (0,1)

getCurrentTime

Returns current video time

Code Return
[player getCurrentTime] Double

getDuration

Returns length of the video

Code Return
[player getDuration] Double

getMuted

Returns video muted boolean

Code Return
[player getMuted] Boolean (0,1)

getVolume

Returns volume of the video

Code Return
[player getVolume] Float

getIsAdInProgress

Return if ad is in progress

Code Return
[player isAdInProgress] Boolean (0,1)

getCurrentIndex

Returns index of the video in the playlist

Code Return
[player getCurrentIndex] NSInteger

getPlaylist

Returns array of video objects

Code Return
[player getPlaylist] NSArray <VideoData>

getSource

Returns URL of the current video file

Code Return
[player getSource] NSString

getVideo

Returns current video object

Code Return
[player getVideo] VideoData

Setters

setVolume

Sets volume of the video

Code Type
[player setVolume:(float)] Float

playByIndex

Plays video with the set index in the playlist

Code Type
[player playByIndex:(int)] NSInteger

setVideo

Sets next video

Code Type
[player setVideo:(VideoData)] VideoData

setVideoUrl

Sets video URL

Code Type
[player setVideoUrl:(string)] NSString

setPlaylist

Sets playlist from JSON

Code Type
[player setPlaylist:(url)] NSURL

setAd

Sets ad object for the next video in the playlist

Code Type
[player setAd:(Array)]; NSArray

playAd

Sets ad object for current video and plays it if (isAdInProgress == 0)

Code Type
[player playAd:(AdData)] AdData

playAdTagUrl

Sets ad URL for current video if (isAdInProgress == 0)

Code Type
[player playAd:(string)] NSString

Set AutohideControls

Sets controls visibility

Code Type
[player autoHideControls] Boolean (0,1)

Events

Player Events

Player events which can be listened:

  1. sec
  2. Play
  3. Pause
  4. Stop
  5. Next
  6. Previous
  7. PlayerInitalized
  8. VideoInitalized
  9. SetupVideo
  10. MuteVideo
  11. UnMuteVideo
  12. GetVolume
  13. SetVolume
  14. GetCurrentTime
  15. GetDuration
  16. GetCurrentIndex
  17. GetSource
  18. PlayByIndex
  19. GetPlaylist
  20. GetVideo
  21. SetVideo
  22. SetVideoUrl
  23. SetAd
  24. SetFullscreen
  25. SliderTouched
  26. SliderRelesed
  27. SliderValueChanged
  28. AdIsInProgress

Subscribe to Player Event Notifications

Notification.name = @”PlayerEvent” notification.userInfo = @“event”

InViewDidLoad:

[[NSNotificationCenter defaultCenter] addobserver:@selector(eventMethod:) name:@”PlayerEvent” object:nil];
Call this method in selector:
- (void)eventMethod:(NSNotification *)notification {
    if ([notification.name isEqualToString:@"PlayerEvent"]) {
        NSLog(@"%@", (NSString *)notification.userInfo[@"event"]);
     }
   }

Ad Events (IMA SDK)

Ad events which can be listened

  1. adBreak Ready
  2. adBreak Ended
  3. adBreak Started
  4. adPeriod Started
  5. adPeriod Ended
  6. adAll Ads Completed
  7. adClicked
  8. adComplete
  9. adCuepoints Changed
  10. adFirst Quartile
  11. adLodaed - ovo je ustvari Ad Request
  12. adLog
  13. adMidpoint
  14. adPaused
  15. adResume
  16. adSkipped
  17. adStarted - ovo je ustvari Ad Impression
  18. adStream Loaded
  19. adStream Started
  20. adTapped
  21. adThrid Quartile

Subscribe to Ad Event Notifications

Notification.name = @”PlayerEvent” notification.userInfo = @“event”

InViewDidLoad(IMA)

[[NSNotificationCenter defaultCenter] addobserver:@selector(adMethod:) name:@”AdEvent” object:nil];

Call this method in selector(IMA)

 - (void)adMethod:(NSNotification *)notification {
    if ([notification.name isEqualToString:@"AdEvent"]) {
        NSLog(@"%@", (NSString *)notification.userInfo[@"adEvent"]);
     }
    }

Ad Events (Brid SDK)

adLoaded - This is actually Ad Request adStarted - This is actually Ad Impression adComplete adErrorAnalytics - adComplete - ad finished adError

Data Objects used by iOS BridSDK

VideoData

Video object initialization

Source ✱source = [[Source alloc] init];
[source setSd:@”your video url”];

VideoData ✱videoObject = [[VideoData alloc] initWithVideo:@”id” 
                                             duration:@””
                                             ageGateId:@”” 
                                             name:@”” 
                                             _description:@”” 
                                             image:@”” 
                                             thumbnail:@””
                                             clickthroughUrl:@”” 
                                             thumb:@””
                                             publish:@””
                                             mimeType:@””
                                             webp:@””
                                             monetize:@””
                                             liveimage:@””
                                             secureUrl:@””
                                             source:(source) 
                                             tracks:(NSArray<Tracks>)];

AdData

Video object initialization

Mobile ✱mobile = [[Mobile alloc] initWithMobile:@”custom id” url:@”your ad url”];
NSMutableArray *mobileArray = [[NSMutableArray alloc] init];
[mobileArray addObject:mobile];

AdData *ad = [[AdData alloc] initWithAdType:@"roll type"
                             overlayStartAt:@""
                             overlayDuration:@""
                             adTimeType:@"s"
                             cuepoints:@""
                             mobile:mobileArray

Macros

Macros that are replaced automatically by SDK:

  1. main_bundle
  2. app_name
  3. device
  4. deviceID
  5. timeStamp
  6. player_width
  7. player_height
  8. latitude
  9. Longitude
  10. user_Ip

Macros that are available to be replaced manually:

  1. user_agent
  2. referrer-url0
  3. page_url
  4. app_store_url
[player setAdMacros: [[AdMacros alloc] initAdMacrosUserAgent:@"" 
                                       referrerUrl:@"" 
                                       pageUrl:@"" 
                                       appStoreUrl:@""