VMediaPlayer Class Reference
| Inherits from | VSingleton |
| Declared in | VMediaPlayer.h |
Tasks
Shared Instance
VMediaPlayer Setup&unSetup Methods
VMediaPlayer Manger Preference Methods
-
autoSwitchDecodingSchemeproperty -
decodingSchemeHintproperty -
decodingSchemeUsingproperty -
useCacheproperty
Player Control
-
– setDataSource: -
– setDataSource:header: -
– setDataSegmentsSource:fileList: -
– setCacheDirectory: -
– setOptionsWithKeys:withValues: -
– prepareAsync -
– start -
– pause -
– isPlaying -
– reset -
– getDuration -
– getCurrentPosition -
– seekTo: -
– setPlaybackSpeed: -
– setAdaptiveStream: -
– isUsingHardwareDecoding -
– setMetaEncoding: -
– getMetaEncoding -
– getMetadata -
– getDiskSize
Video Control
-
– setVideoShown: -
– getVideoTracksArray -
– setVideoTrackWithArrayIndex: -
– getVideoTrackCurrentArrayIndex -
– setVideoQuality: -
– getVideoWidth -
– getVideoHeight -
– getVideoAspectRatio -
– setDeinterlace: -
– getCurrentFrame
Audio Control
-
– getAudioTracksArray -
– setAudioTrackWithArrayIndex: -
– getAudioTrackCurrentArrayIndex -
– setVolume: -
– getVolume -
– setChannelVolumeLeft:right: -
– getChannelVolumeLeft:right: -
– setAudioAmplify:
Subtitle Control
-
– setSubShown: -
– getSubTracksArray -
– setSubTrackWithArrayIndex: -
– getSubTrackCurrentArrayIndex -
– addSubTrackToArrayWithPath: -
– setSubTrackWithPath: -
– getCurSubText -
– setSubEncoding:
Buffering
Caches
Player View Control
Properties
autoSwitchDecodingScheme
Specifies whether auto switch decoding scheme when media player prepared failed
with the hint of decodingSchemeHint, default is YES.
@property (atomic, assign, readwrite) BOOL autoSwitchDecodingSchemeSee Also
Declared In
VMediaPlayer.hdecodingSchemeHint
Specifies the hint of decoding scheme, default is VMDecodingSchemeSoftware.
@property (atomic, assign, readwrite) emVMDecodingScheme decodingSchemeHintSee Also
Declared In
VMediaPlayer.hdecodingSchemeUsing
The decoding scheme of media player using at this time.
@property (atomic, assign, readonly) emVMDecodingScheme decodingSchemeUsingSee Also
Declared In
VMediaPlayer.hInstance Methods
setupPlayerWithCarrierView:withDelegate:
Setup the media player to work with the given view and the given VMediaPlayerDelegate implementor.
- (BOOL)setupPlayerWithCarrierView:(UIView *)carrier withDelegate:(id<VMediaPlayerDelegate>)dlgParameters
- carrier
The view of video picture will rendering to.
- delegate
The protocol to setup.
Return Value
Returns YES or NO if setup fails.
See Also
Declared In
VMediaPlayer.hunSetupPlayer
Unsetup the media player.
- (BOOL)unSetupPlayerReturn Value
Returns YES or NO if the media player have not ever setup yet.
Declared In
VMediaPlayer.hsetDataSource:
Set the media url to media player.
- (void)setDataSource:(NSURL *)mediaURLParameters
- mediaURL
The url of media want to play.
See Also
Declared In
VMediaPlayer.hsetDataSource:header:
Set the media url to media player, and also pass protocol header to it.
- (void)setDataSource:(NSURL *)mediaURL header:(NSString *)headerParameters
- mediaURL
The url of media want to play.
- header
The protocol header, e.g. HTTP header.
Discussion
This method is provide for some online media stream, the parameter header is usefull for media player on open and prepare the media stream, but it is not necessary. optionally, You can use setOptionsWithKeys:withValues: method to do that.
Declared In
VMediaPlayer.hsetDataSegmentsSource:fileList:
Set the media segment urls to media player.
- (void)setDataSegmentsSource:(NSString *)baseURL fileList:(NSArray *)listParameters
- baseURL
The base url to locate steam file list. Can be nil.
- list
The segments list.
Discussion
This method is provide for some media stream, which contain by many segments.
See Also
Declared In
VMediaPlayer.hsetCacheDirectory:
Set the diretory for cache data to store.
- (void)setCacheDirectory:(NSString *)directoryDiscussion
@param directory
Declared In
VMediaPlayer.hsetOptionsWithKeys:withValues:
Pass options to media.
- (void)setOptionsWithKeys:(NSArray *)keys withValues:(NSArray *)valuesDiscussion
@param keys @param values
See Also
Declared In
VMediaPlayer.hprepareAsync
Prepares the player for playback, asynchronously.
- (void)prepareAsyncDiscussion
After setting the datasource , you need to call prepareAsync, which returns immediately.
It will trigger the protocol mediaPlayer:didPrepared: when player prepared successfully
or mediaPlayer:erro: if failed.
See Also
Declared In
VMediaPlayer.hstart
Starts or resumes playback.
- (void)startDiscussion
If playback had previously been paused, playback will continue from where it was paused. If playback had been stopped, or never started before, playback will start at the beginning.
Declared In
VMediaPlayer.hisPlaying
Checks whether the VMediaPlayer is playing.
- (BOOL)isPlayingReturn Value
YES if currently playing, NO otherwise.
Declared In
VMediaPlayer.hreset
Resets the VMediaPlayer to its uninitialized state.
- (void)resetDiscussion
After calling this
method, you will have to initialize it again by setting the data source setDataSource: and
calling prepareAsync.
Declared In
VMediaPlayer.hgetDuration
Gets the duration of the media.
- (long)getDurationReturn Value
Returns the duration in milliseconds, or -1 if error occur.
Declared In
VMediaPlayer.hgetCurrentPosition
Gets the current playback position.
- (long)getCurrentPositionReturn Value
Returns the current position in milliseconds, or -1 if orror occur.
Declared In
VMediaPlayer.hseekTo:
Seeks to specified time position.
- (void)seekTo:(long)msecParameters
- msec
the offset in milliseconds from the start to seek to.
Declared In
VMediaPlayer.hsetPlaybackSpeed:
Set video and audio playback speed.
- (void)setPlaybackSpeed:(float)speedParameters
- speed
e.g. 0.8 or 2.0, default to 1.0, range in [0.5-2]
Declared In
VMediaPlayer.hsetAdaptiveStream:
Adaptive streaming support, default is NO.
- (BOOL)setAdaptiveStream:(BOOL)adaptiveParameters
- adaptive
YES if wanna adaptive steam.
Declared In
VMediaPlayer.hisUsingHardwareDecoding
Checks whether the VMediaPlayer is using hardware decoding.
- (BOOL)isUsingHardwareDecodingReturn Value
Returns YES if it is using hardware decoding, NO otherwise.
Declared In
VMediaPlayer.hsetMetaEncoding:
Set the encoding VMediaPlayer will use to determine the metadata.
- (void)setMetaEncoding:(NSString *)encodingParameters
- encoding
e.g. “UTF-8”
Declared In
VMediaPlayer.hgetMetaEncoding
Get the encoding if haven’t set with setMetaEncoding:
- (NSString *)getMetaEncodingReturn Value
Returns the encoding of meta data, or nil if error occurs.
Declared In
VMediaPlayer.hgetMetadata
Gets the media metadata.
- (NSDictionary *)getMetadataReturn Value
Returns the metadata, possibly empty, or nil if errors occurred.
Declared In
VMediaPlayer.hgetDiskSize
Gets the size on disk of the media.
- (long long)getDiskSizeReturn Value
Return the size in bytes, or -1 if error occurs.
Declared In
VMediaPlayer.hsetVideoShown:
Tell the VMediaPlayer whether to show video.
- (void)setVideoShown:(BOOL)shownParameters
- shown
YES if wanna show
Declared In
VMediaPlayer.hgetVideoTracksArray
- Returns an array of video tracks information. *
- The usage see in
getAudioTracksArray.
- (NSArray *)getVideoTracksArrayDiscussion
- @return Returns Array of video track info. The total number of tracks is the array length;
if error occurs, nil is returned.
Declared In
VMediaPlayer.hsetVideoTrackWithArrayIndex:
Switch to a new video track.
- (BOOL)setVideoTrackWithArrayIndex:(int)indexParameters
- index
One of the indexes of array return by
getVideoTracksArray.
Return Value
Returns YES for success or NO if error occur.
Discussion
Tell VMediaPlayer switch the video track to the new track indicate by index.
See Also
Declared In
VMediaPlayer.hgetVideoTrackCurrentArrayIndex
Get the video track index of player play currently.
- (int)getVideoTrackCurrentArrayIndexReturn Value
Returns the video track index play currently, or -1 if error occurs.
See Also
Declared In
VMediaPlayer.hsetVideoQuality:
Set the quality when play video.
- (void)setVideoQuality:(emVMVideoQuality)qualityParameters
- quality
The quality(
emVMVideoQuality) want to set.
Discussion
If the video is too lag, you may try VIDEOQUALITY_LOW, default is VIDEOQUALITY_LOW.
Declared In
VMediaPlayer.hgetVideoWidth
Returns the width of the video.
- (int)getVideoWidthReturn Value
The width of the video, or 0 if there is no video, or the width has not been determined yet.
Declared In
VMediaPlayer.hgetVideoHeight
Returns the height of the video.
- (int)getVideoHeightReturn Value
The height of the video, or 0 if there is no video, or the height has not been determined yet.
Declared In
VMediaPlayer.hgetVideoAspectRatio
Returns the aspect ratio of the video.
- (float)getVideoAspectRatioReturn Value
The aspect ratio of the video, or 0 if there is no video, or the width and height is not available.
Declared In
VMediaPlayer.hsetDeinterlace:
Set if should deinterlace the video picture.
- (void)setDeinterlace:(BOOL)deinterlaceParameters
- deinterlace
Pass YES if need deinterlace, NO if not.
Declared In
VMediaPlayer.hgetCurrentFrame
Get the current video frame.
- (UIImage *)getCurrentFrameReturn Value
Return the UIImage object, or nil if error occurs.
Declared In
VMediaPlayer.hgetAudioTracksArray
Returns an array of audio tracks information.
- (NSArray *)getAudioTracksArrayReturn Value
Returns array of audio track info. The total number of tracks is the array length; returns nil if the current decoding scheme is not support get audio track info.
Discussion
The return array is contained by NSDictionary. Every track infomation map to a dictionary.
You can use the key of VMMediaTrackLocationType or VMMediaTrackId etc. to get the
detail. Here’s an example of simple usage:
NSArray *tracks = [player getAudioTracksArray];
for (NSDictionary *track in tracks) {
NSLog(@"LocationType: %d, id: %d, title: %@, exPath: %@",
[track[VMMediaTrackLocationType] intValue],
track[VMMediaTrackId] ? [track[VMMediaTrackId] intValue] : -1,
track[VMMediaTrackTitle] ? track[VMMediaTrackTitle] : @"(none)",
track[VMMediaTrackFilePath] ? track[VMMediaTrackFilePath] : @"(none)"
);
}
Declared In
VMediaPlayer.hsetAudioTrackWithArrayIndex:
Switch to a new audio track.
- (BOOL)setAudioTrackWithArrayIndex:(int)indexParameters
- index
One of the indexes of array return by
getAudioTracksArray.
Return Value
Returns YES for success or NO if error occur.
Discussion
Tell VMediaPlayer switch the audio track to the new track indicate by index.
See Also
Declared In
VMediaPlayer.hgetAudioTrackCurrentArrayIndex
Get the audio track index of player play currently.
- (int)getAudioTrackCurrentArrayIndexReturn Value
Returns the audio track index play currently, or -1 if error occurs.
See Also
Declared In
VMediaPlayer.hsetVolume:
Set the media player output volume.
- (void)setVolume:(float)volumeParameters
- volume
The volume value, range in [0.0-1.0].
Declared In
VMediaPlayer.hgetVolume
Get the media player output volume value.
- (float)getVolumeReturn Value
Returns the current media player volume.
Declared In
VMediaPlayer.hsetChannelVolumeLeft:right:
Set the left/right volume balance for a stereo audio.
- (void)setChannelVolumeLeft:(float)left right:(float)rightParameters
- left
The left balance, range in [0.0-1.0].
- right
The right balance, range in [0.0-1.0].
Declared In
VMediaPlayer.hgetChannelVolumeLeft:right:
Get the left/right volume balance for a stereo audio.
- (void)getChannelVolumeLeft:(float *)left right:(float *)rightParameters
- left
The left balance return store in *left.
- right
The right balance return store in *left.
Declared In
VMediaPlayer.hsetAudioAmplify:
Amplify audio
- (BOOL)setAudioAmplify:(float)ratioParameters
- ratio
e.g. 3.5
Declared In
VMediaPlayer.hsetSubShown:
Tell the VMediaPlayer whether to show timed text.
- (void)setSubShown:(BOOL)shownParameters
- shown
YES if wanna show
Declared In
VMediaPlayer.hgetSubTracksArray
Returns an array of subtitle tracks information.
- (NSArray *)getSubTracksArrayReturn Value
Return array of subtitle track info, The total number of tracks is the array length; if error occurs, nil is returned.
Discussion
The usage see in getAudioTracksArray.
Declared In
VMediaPlayer.hsetSubTrackWithArrayIndex:
Switch to a new subtitle track.
- (BOOL)setSubTrackWithArrayIndex:(int)indexParameters
- index
One of the indexes of array return by
getSubTracksArray.
Return Value
Returns YES for success or NO if error occur.
Discussion
Tell VMediaPlayer switch the subtitle track to the new track indicate by index.
See Also
Declared In
VMediaPlayer.hgetSubTrackCurrentArrayIndex
Get the subtitle track index of player play currently.
- (int)getSubTrackCurrentArrayIndexReturn Value
Returns the subtitle track index play currently, -1 if error occurs.
See Also
Declared In
VMediaPlayer.haddSubTrackToArrayWithPath:
Add a new subtitle track in exteranl subtitle file to the subtitle array.
It will contain in the array return by follow called getSubTracksArray.
- (BOOL)addSubTrackToArrayWithPath:(NSString *)pathParameters
- path
The path of external subtitle to add.
Return Value
Returns YES or NO if error occurs.
See Also
Declared In
VMediaPlayer.hsetSubTrackWithPath:
Switch to a new subtitle track by external subtitle.
- (void)setSubTrackWithPath:(NSString *)pathParameters
- path
The path of external subtitle to use.
Declared In
VMediaPlayer.hgetCurSubText
Get the timed text at current time.
- (NSString *)getCurSubTextReturn Value
Returns timed text.
Declared In
VMediaPlayer.hsetSubEncoding:
Set the encoding to display timed text.
- (void)setSubEncoding:(NSString *)encodingParameters
- encoding
VMediaPlayer will detet it if nil.
Declared In
VMediaPlayer.hsetBufferSize:
The buffer to fill before playback, default is 1024KB
- (void)setBufferSize:(int)bufSizeParameters
- bufSize
buffer size in Byte
Declared In
VMediaPlayer.hisBuffering
Checks whether the buffer is filled
- (BOOL)isBufferingReturn Value
NO if buffer is filled
Declared In
VMediaPlayer.hgetBufferProgress
Get buffer progress.
- (int)getBufferProgressReturn Value
the percent
Declared In
VMediaPlayer.hsetVideoFillMode:
Tell media playback view which video fill mode to use.
- (void)setVideoFillMode:(emVMVideoFillMode)fillModeParameters
- fillMode
The mode in
emVMVideoFillMode
Declared In
VMediaPlayer.hgetVideoFillMode
Get video fill mode of playback view using.
- (emVMVideoFillMode)getVideoFillModeReturn Value
The mode using now.
Declared In
VMediaPlayer.hsetVideoFillScale:
Set the playback view scale, default 1.0
- (void)setVideoFillScale:(float)scaleParameters
- scale
e.g. 0.5
Declared In
VMediaPlayer.hgetVideoFillScale
Get the current playback view scale.
- (float)getVideoFillScaleReturn Value
The playback scale.
Declared In
VMediaPlayer.hsetVideoFillAspectRatio:
Set the playback view aspect ratio.
- (void)setVideoFillAspectRatio:(float)ratioParameters
- ratio
aspect ratio
Discussion
The aspect ratio of video is auto detect by VMediaPlayer, but it may be failed, so you need use this method to set the right aspect ratio for media player.
Declared In
VMediaPlayer.h