VKPlayerControllerBase Class Reference

Inherits from NSObject
Declared in VKPlayerControllerBase.h

Overview

  • A Player object which is subclass of NSObject, player can be used in embedded and/or fullscreen or non UI. Also, more than one instance can be added in a same view without causing any problem like interfereing… Player is similar to Apple’s native API “MPMovieController”, so it’s as easy as using the MPMovieController

– initBase

Initialization of VKPlayerControllerBase object

- (id)initBase

Return Value

VKPlayerControllerBase object

Declared In

VKPlayerControllerBase.h

– initWithURLString:

Initialization of VKPlayerControllerBase object with the url string object

- (id)initWithURLString:(NSString *)urlString

Parameters

urlString

The location of the file or remote stream url. If it’s a file then it must be located either in your app directory or on a remote server

Return Value

VKPlayerControllerBase object

Declared In

VKPlayerControllerBase.h

– createUICenter

This method creates UI elements in the center of the screen

- (void)createUICenter

Declared In

VKPlayerControllerBase.h

– play

This method plays the stream/file if urlstring is given in the initialization or content url is set

- (void)play

Declared In

VKPlayerControllerBase.h

– togglePause

Toggle play or pause the stream/file

- (void)togglePause

Declared In

VKPlayerControllerBase.h

– stop

This method stops the stream/file

- (void)stop

Declared In

VKPlayerControllerBase.h

– zoomInOut:

Frames are drawn on view, so scale method switches view contentmode property from UIViewContentModeScaleAspectFit to UIViewContentModeScaleAspectFill or the opposite

- (void)zoomInOut:(UITapGestureRecognizer *)sender

Declared In

VKPlayerControllerBase.h

– stepToNextFrame

Update the screen with the following video frame

- (void)stepToNextFrame

Declared In

VKPlayerControllerBase.h

– setStreamCurrentDuration:

Set current duration in files both for located locally or located remotely

- (void)setStreamCurrentDuration:(float)value

Parameters

value

A double value in seconds

Declared In

VKPlayerControllerBase.h

– changeAudioStream

Cycle/Change to next the audio stream if remote stream/file has more than 1 audio stream

- (void)changeAudioStream

Declared In

VKPlayerControllerBase.h

– changeVideoStream

Cycle/Change to next the video stream if remote stream/file has more than 1 video stream

- (void)changeVideoStream

Declared In

VKPlayerControllerBase.h

– setMute:

Mute audio

- (void)setMute:(BOOL)value

Parameters

value

If YES, audio will be muted

Discussion

This does not have any effect on MPVolumeView or not have any relation with MPVolumeView

Declared In

VKPlayerControllerBase.h

– setVolumeLevel:

Set player’s volume level

- (void)setVolumeLevel:(float)value

Parameters

value

must be between 0.0 & 1.0, when value is 0.0, player is muted, default is 1.0

Discussion

This does not have any effect on MPVolumeView or not have any relation with MPVolumeView

Declared In

VKPlayerControllerBase.h

– playableAudioStreams

Retreive all audio streams in stream

- (NSArray *)playableAudioStreams

Declared In

VKPlayerControllerBase.h

– playableVideoStreams

Retreive all videos streams in stream

- (NSArray *)playableVideoStreams

Declared In

VKPlayerControllerBase.h

– snapshot

Get snapshot of glview in UIImage format

- (UIImage *)snapshot

Return Value

UIImage object

Discussion

Sample code to show how to save the snapshot

NSArray paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString documentsDirectory = [paths objectAtIndex:0]; NSString savedImagePath = [documentsDirectory stringByAppendingPathComponent:@“savedImage.png”]; UIImage image = [self snapshot]; NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:NO];

Declared In

VKPlayerControllerBase.h

– snapshotOriginalSize

Get snapshot from video stream in original size in UIImage format

- (UIImage *)snapshotOriginalSize

Return Value

UIImage object

Discussion

It’s slower than getting snapshot from glview

Sample code to show how to save the snapshot

NSArray paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString documentsDirectory = [paths objectAtIndex:0]; NSString savedImagePath = [documentsDirectory stringByAppendingPathComponent:@“savedImage.png”]; UIImage image = [self snapshot]; NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:NO];

Declared In

VKPlayerControllerBase.h

– startRecording

Start recording file/network stream

- (void)startRecording

Declared In

VKPlayerControllerBase.h

– stopRecording

Stop recording file/network stream

- (void)stopRecording

Declared In

VKPlayerControllerBase.h

– stopDurationTimer

Stops duration Timer

- (void)stopDurationTimer

Declared In

VKPlayerControllerBase.h

– startDurationTimer

Starts duration Timer

- (void)startDurationTimer

Declared In

VKPlayerControllerBase.h

– startElapsedTimer

Starts elapsed Timer

- (void)startElapsedTimer

Declared In

VKPlayerControllerBase.h

– stopElapsedTimer

Stops elapsed Timer

- (void)stopElapsedTimer

Declared In

VKPlayerControllerBase.h

– onTimerElapsedFired:

Timer callback when the elapsed timer is fired

- (void)onTimerElapsedFired:(NSTimer *)timer

Parameters

timer

NSTimer object instance for elapsed timer

Declared In

VKPlayerControllerBase.h

– showControlPanel:willExpire:

Show/Hide control panel on the screen

- (void)showControlPanel:(BOOL)show willExpire:(BOOL)expire

Parameters

show

Specify YES, If you want to show control panel components on the screen. Specify NO, If you want to hide control panel components.

expire

Specify YES, If you want the control panel to hide after a certain amount of time

Declared In

VKPlayerControllerBase.h

– setFullScreen:animated:

Make embedded player fullscreen or make fullscreen player embedded

- (void)setFullScreen:(BOOL)value animated:(BOOL)animated

Parameters

value

Specify YES, If you want to show the player in fullscreen, does not have any effect on fullscreen player. Specify NO, If you want to show the player in embedded, does not have any effect on embedded player

animated

Specify YES If the transitions will be animated

Declared In

VKPlayerControllerBase.h

  contentURLString

The location of the file or remote stream url in string format. If it’s a file then it must be located either in your app directory or on a remote server

@property (nonatomic, retain) NSString *contentURLString

Declared In

VKPlayerControllerBase.h

  decoderOptions

Streaming options according to the used protocol

@property (nonatomic, retain) NSDictionary *decoderOptions

Declared In

VKPlayerControllerBase.h

  decoderState

Indicates the decoder states in VKDecoderState enumerations

@property (nonatomic, readonly) VKDecoderState decoderState

Declared In

VKPlayerControllerBase.h

  barTitle

The bar title of Video Player

@property (nonatomic, retain) NSString *barTitle

Declared In

VKPlayerControllerBase.h

  delegate

Set your Parent View Controller as delegate If you want to be notified for state changes

@property (nonatomic, assign) id<VKPlayerControllerDelegate> delegate

Declared In

VKPlayerControllerBase.h

  customIODelegate

Set your Parent View Controller as delegate If you want to be provide custom I/O data to ffmpeg, it’s very useful when decoding a(n) audio/video stream in memory

@property (nonatomic, assign) id<VKPlayerCustomIODelegate> customIODelegate

Declared In

VKPlayerControllerBase.h

  statusBarHidden

Specify YES to hide status bar, default is NO. Effective only in fullscreen presenting

@property (nonatomic, assign, getter=isStatusBarHidden) BOOL statusBarHidden

Declared In

VKPlayerControllerBase.h

  staturBarInitialText

A text shown when first loading media stream/file.

@property (nonatomic, readonly) NSString *staturBarInitialText

Declared In

VKPlayerControllerBase.h

  view

VKPlayerControllerBase view object, any custom views must be added on this

@property (nonatomic, retain, readonly) UIView *view

Declared In

VKPlayerControllerBase.h

  renderView

The video rendering view, opengl configuration is done to be ready for rendering

@property (nonatomic, readonly) VKGLES2View *renderView

Declared In

VKPlayerControllerBase.h

  scrollView

The scroll view for render view, scrollview helps render view zoom & scroll to anywhere in video frame

@property (nonatomic, readonly) VKScrollViewContainer *scrollView

Declared In

VKPlayerControllerBase.h

  backgroundColor

The background color of player, default is black

@property (nonatomic, retain) UIColor *backgroundColor

Declared In

VKPlayerControllerBase.h

  containerVc

An empty and transparent UIViewController used for fullscreen - embedded transitioning. Do not set it If you have a very powerful reason to do that

@property (nonatomic, assign) UIViewController *containerVc

Declared In

VKPlayerControllerBase.h

  fullScreen

Indicates the state of player presenting mode. If set, then this makes embedded player fullscreen or makes fullscreen player embedded

@property (nonatomic, assign, getter=isFullScreen) BOOL fullScreen

Declared In

VKPlayerControllerBase.h

  initialPlaybackTime

The time, specified in seconds within the video timeline, when playback should start

@property (nonatomic, assign) int64_t initialPlaybackTime

Declared In

VKPlayerControllerBase.h

  loopPlayback

Loops movie playback times. 0 means forever

@property (nonatomic, assign) int loopPlayback

Declared In

VKPlayerControllerBase.h

  autoStopAtEnd

Stop player when video is done playing

@property (nonatomic, assign) BOOL autoStopAtEnd

Declared In

VKPlayerControllerBase.h

  allowsAirPlay

Specify YES to show video in extended screen, default is No

@property (nonatomic, assign) BOOL allowsAirPlay

Declared In

VKPlayerControllerBase.h

  mainScreenIsMobile

Indicates the active screen is mobile or not. (If not using airplay or TV connection with cable, this value is always YES)

@property (nonatomic, readonly) BOOL mainScreenIsMobile

Declared In

VKPlayerControllerBase.h

  showPictureOnInitialBuffering

Specify YES to show first video picture during the initial buffering, default is NO

@property (nonatomic, assign) BOOL showPictureOnInitialBuffering

Declared In

VKPlayerControllerBase.h

  fillScreen

Specify YES to fit video frames fill to the player view, default is NO

@property (nonatomic, assign) BOOL fillScreen

Declared In

VKPlayerControllerBase.h

  allowsMicCapturing

Specify YES to setup VideoKit AVAudioSession property also suitable for microphone capturing, default is NO. (this property is effectiveless in tvOS platform)

@property (nonatomic, assign) BOOL allowsMicCapturing

Declared In

VKPlayerControllerBase.h

  enableCustomIO

Specify YES to enable providing custom I/O data to ffmpeg, it’s very useful when decoding a(n) audio/video stream in memory, default is NO

@property (nonatomic, assign) BOOL enableCustomIO

Declared In

VKPlayerControllerBase.h

  customIO

This is a helper struct for implementing custom IO feature. Please see the struct details for more info.

@property (nonatomic, readonly) struct VKPlayerCustomIO *customIO

Declared In

VKPlayerControllerBase.h

  enableICYMetadata

Specify YES to enable metadata information for http shoutcast/icy protocols, default is NO.

@property (nonatomic, assign) BOOL enableICYMetadata

Declared In

VKPlayerControllerBase.h

  recordingEnabled

Specify YES to enable recording functionality, default is NO

@property (nonatomic, assign, getter=isRecordingEnabled) BOOL recordingEnabled

Declared In

VKPlayerControllerBase.h

  username

If license-form is not accessible, fill this parameter with your username taken from our server

@property (nonatomic, retain) NSString *username

Declared In

VKPlayerControllerBase.h

  secret

If license-form is not accessible, fill this parameter with your secret taken from our server

@property (nonatomic, retain) NSString *secret

Declared In

VKPlayerControllerBase.h