-
Notifications
You must be signed in to change notification settings - Fork 6
SNMediaPlayer
Conforms to NSObject
Declared in SNMediaPlayer.h
多媒体播放器, 支持aac, mp3, m4a, mp4
– playWithPath:isRepeat: required method
– playVideoWithPath:isRepeat:inView: required method
– stop required method
– pause required method
– resume required method
– setVolume: required method
– volume required method
– duration required method
– duration: required method
– seekTo: required method
– onPlayProgress required method
– onPlayBegin required method
– onPlayEnd required method
– onBufferBegin required method
– onBufferEnd required method
– onPlayError required method
– playerIdentifier required method
– setView: required method
– getAudioStreamCount required method
– setAudioStream: required method
– destroy required method
- (void)destroy
SNMediaPlayer.h
获取当前长度
- (RACSignal *)duration
bgm 时长,单位毫秒
获取当前长度
SNMediaPlayer.h
获取指定路径长度
- (RACSignal *)duration:(NSString *)*path*
bgm 时长,单位毫秒
获取指定路径长度
SNMediaPlayer.h
获取音轨数量
- (NSInteger)getAudioStreamCount
获取音轨数量
SNMediaPlayer.h
开始缓冲回调
- (RACSubject *)onBufferBegin
开始缓冲回调
SNMediaPlayer.h
结束缓冲回调
- (RACSubject *)onBufferEnd
结束缓冲回调
SNMediaPlayer.h
播放开始
- (RACSubject *)onPlayBegin
播放开始
SNMediaPlayer.h
播放结束
- (RACSubject *)onPlayEnd
播放结束
SNMediaPlayer.h
播放失败回调
- (RACSubject *)onPlayError
播放失败回调
SNMediaPlayer.h
播放进度回调,回调的频率默认是 1000ms。 注意:回调不在主线程,涉及到UI请自行切换到主线程
- (RACSubject *)onPlayProgress
播放进度回调,回调的频率默认是 1000ms。 注意:回调不在主线程,涉及到UI请自行切换到主线程
SNMediaPlayer.h
暂停播放
- (RACSignal *)pause
完成回调
暂停播放
SNMediaPlayer.h
播放视频
- (RACSignal *)playVideoWithPath:(NSString *)*path* isRepeat:(BOOL)*isRepeat* inView:(nullable UIView *)*view*
path
路径
isRepeat
是否重复播放
view
用于展示视频的 view
开始播放回调
播放视频
SNMediaPlayer.h
播放
- (RACSignal *)playWithPath:(NSString *)*path* isRepeat:(BOOL)*isRepeat*
path
路径
isRepeat
是否重复播放
开始播放回调
播放
SNMediaPlayer.h
- (NSInteger)playerIdentifier
SNMediaPlayer.h
继续播放
- (RACSignal *)resume
完成回调
继续播放
SNMediaPlayer.h
设置当前播放位置, 单位毫秒
- (RACSignal *)seekTo:(NSInteger)*position*
完成回调,包含的值为seek的最终值(会和position有偏差)
设置当前播放位置, 单位毫秒
SNMediaPlayer.h
设置播放音轨
- (BOOL)setAudioStream:(SNPlayerAudioStreamIndex)*index*
index
音轨下标,@see SNPlayerAudioStreamIndex,
default is SNPlayerAudioStreamIndexOri
设置播放音轨
SNMediaPlayer.h
设置(更新)播放器播放的 view
- (void)setView:(nullable UIView *)*view*
设置(更新)播放器播放的 view
SNMediaPlayer.h
设置音量, 音量大小,100为正常音量,取值范围为0 - 200;默认值:100
- (void)setVolume:(NSInteger)*volume*
设置音量, 音量大小,100为正常音量,取值范围为0 - 200;默认值:100
SNMediaPlayer.h
停止播放
- (RACSignal *)stop
完成回调
停止播放
SNMediaPlayer.h
获取音量大小,范围为0-200
- (NSInteger)volume
获取音量大小,范围为0-200
SNMediaPlayer.h
Sona Wiki