Skip to main content

Analytics

Events

You can get various player states from the app by setting the on function.

class ViewController : UIViewController {
let vpplayer: VPPlayer = VPPlayer()

override func viewDidLoad ()
{
vpplayer.on { (event, args) in
// Example
if VPPlayerEvent.loaded == event {
print(event)
}
}
}
}

PlayerState Types and Return Value

PlayerStateDescriptionValue Return Type
playUser clicked play buttonBool
pausedVideo is pausedBool
timeupdateNotifies each second of current video playingCMTime
canplayCan play or not VideoBool
endedVideo has endedBool
replayVideo is replayedBool
rewindUser clicked rewind buttonInt
forwardUser clicked forward buttonInt
seekingUser seeking with sliderDouble
seekStartedPosition were seeking with slider startedDouble
seekEndedPosition were seeking with slider endedDouble
muteVideo is mutedInt
changeQualityUser changed qualityString
changeCaptionsUser changed captionsInt
orientationChangeOrientation changedPlayerOrientation
volumechangeUser changed volumeInt
loadedVideo is loadedBool
nextNext video is loadedBool
shareUser clicked share buttonBool
bufferingVideo is bufferingBool
bufferedVideo bufferedBool
nextVideoClickedUser clicked next videoBool
previousVideoClickedUser clicked previous videoBool

Ad States

PlayerStateDescriptionValue Return Type
adStateCurrent state of AdIMAAdEvent
adLoadedAd content loadedBool
adStartedAd content startedBool
adCompleteAd content CompletedBool
adClickedAd content link clickedBool
adSkippedAd content skip clickedBool
adAllAdsCompletedAll Ad content completedBool
adFirstQuartileFirst Quartile of Ad content watchedBool
adMidpointMid point of Ad content watchedBool
adThirdQuartileThird point of Ad content watchedBool

Status

You can get various player status from the app by setting the getStatusBlock function.

vpplayer.getStatusBlock {
[weak self]
(status)
in switch status {
case .failed (let error) : print (error)
case .ready : print ("Ready to Play")
case .playing : print ("Playing")
case .pause : print ("Pause")
case .end : print ("End")
default : break
}
}
StatusDescription
failedPlayer failed to play video
readyPlayer ready to play video
playingPlayer playing video
pausePlayer paused video
endVideo in player ended

Player Orientation

You can get player orientation from the app by setting the getOrientationChange function.

vpplayer.getOrientationChange {
(status)
in print (status)
// prints player orientation status
}
StatusDescription
landscapeLeftPlayer orientation landscape left.
landscapeRightPlayer orientation landscape right.
portraitPlayer orientation portrait.