ngui/media
Class: Video
- 繼承于
Image
需要加入到gui
視圖樹中才可正常工作
Video.onWaitBuffer
緩沖等待時(shí)觸發(fā), 事件數(shù)據(jù)為0.0-1.0
float
數(shù),1.0
表示緩沖完成
Video.onReady
數(shù)據(jù)源準(zhǔn)備完成,可以開始播放時(shí)觸發(fā)
Video.onStartPlay
真正開始播放時(shí)觸發(fā)
Video.onError
異常時(shí)觸發(fā)
Video.onSourceEof
數(shù)據(jù)源結(jié)束時(shí)觸發(fā),但可能播放還未結(jié)束,因?yàn)榫彌_區(qū)與解碼緩沖中還有數(shù)據(jù)
Video.onPause
播放暫停時(shí)觸發(fā)
Video.onResume
從暫停中恢復(fù)時(shí)觸發(fā)
Video.onStop
播放停止時(shí)觸發(fā)
Video.onSeek
seek
時(shí)觸發(fā)
Video.autoPlay
Default true
在數(shù)據(jù)源準(zhǔn)備好時(shí)是否自動開始播放,false
需要調(diào)用start()
開始播放
Get: Video.sourceStatus
當(dāng)前數(shù)據(jù)源狀態(tài)
Get: Video.status
當(dāng)前播放狀態(tài)
Video.mute
是否靜音
Video.volume
音頻音量0-100
之間
Video.src
視頻源地址,可以為本地路徑也可以為網(wǎng)絡(luò)路徑
Get: Video.time
視頻當(dāng)前播放的時(shí)間毫秒數(shù)
Get: Video.duration
視頻的總長度毫秒數(shù)
Get: Video.audioTrackIndex
當(dāng)前音頻軌道索引
Get: Video.audioTrackCount
支持音頻軌道數(shù)
Video.disableWaitBuffer
禁用等待數(shù)據(jù)緩沖,只要有數(shù)據(jù)立即呈現(xiàn),不等待
Video.selectAudioTrack(index)
選擇音頻軌道
- @arg
index
{uint
} audio track index
Video.audioTrack([index])
獲取音頻軌道信息,不傳入index
返回當(dāng)前選擇的軌道
Video.videoTrack()
獲取視頻軌道信息
Video.start()
開始播放
Video.seek(time)
跳轉(zhuǎn)到目標(biāo)time
位置
- @arg
time
{uint
} ms
毫秒
- @ret {
bool
} success return true
Video.pause()
暫停播放
Video.resume()
恢復(fù)播放
Video.stop()
停止播放
Class: AudioPlayer
音頻播放器與視頻播放器的成員幾乎完全相同
AudioPlayer.onWaitBuffer
AudioPlayer.onReady
AudioPlayer.onStartPlay
AudioPlayer.onError
AudioPlayer.onSourceEof
AudioPlayer.onPause
AudioPlayer.onResume
AudioPlayer.onStop
AudioPlayer.onSeek
AudioPlayer.constructor([src])
這里如果傳入有效源src
會自動開始播放
AudioPlayer.autoPlay
Get: AudioPlayer.sourceStatus
Get: AudioPlayer.status
AudioPlayer.mute
AudioPlayer.volume
AudioPlayer.src
Get: AudioPlayer.time
Get: AudioPlayer.duration
Get: AudioPlayer.trackIndex
Get: AudioPlayer.trackCount
AudioPlayer.disableWaitBuffer
AudioPlayer.selectTrack(index)
選擇音播放的頻軌道
- @arg
index
{uint
} audio track index
AudioPlayer.track([index])
不傳入index
默認(rèn)返回當(dāng)前播放的軌道信息
AudioPlayer.start()
AudioPlayer.seek(time)
- @arg
time
{uint
} ms
- @ret {
bool
} success return true
AudioPlayer.pause()
AudioPlayer.resume()
AudioPlayer.stop()
Object: TrackInfo
多媒體軌道信息描述數(shù)據(jù),這是個(gè)Object
類型描述并沒有實(shí)際存在的構(gòu)造函數(shù)
TrackInfo.type
軌道類型,聲音或視頻
TrackInfo.mime
Mime類型字符串
TrackInfo.width
輸出圖像寬度
TrackInfo.height
輸出圖像高度
TrackInfo.language
語言字符串
TrackInfo.bitrate
碼率
TrackInfo.sampleRate
聲音采樣率
TrackInfo.channelCount
聲音聲道數(shù)量
TrackInfo.channelLayout
音頻聲道布局掩碼 AudioChannelMask
TrackInfo.frameInterval
圖像幀時(shí)間間隔 ms
Enum: MediaType
MEDIA_TYPE_AUDIO
MEDIA_TYPE_VIDEO
Enum: PlayerStatus
PLAYER_STATUS_STOP
PLAYER_STATUS_START
- 已調(diào)用
start()
開始播放,但還未真正開始播放
PLAYER_STATUS_PLAYING
PLAYER_STATUS_PAUSED
Enum: MultimediaSourceStatus
MULTIMEDIA_SOURCE_STATUS_UNINITIALIZED
MULTIMEDIA_SOURCE_STATUS_READYING
MULTIMEDIA_SOURCE_STATUS_READY
- 數(shù)據(jù)源已準(zhǔn)備好,數(shù)據(jù)源正常工作時(shí)大部分時(shí)間都是這個(gè)狀態(tài)
MULTIMEDIA_SOURCE_STATUS_WAIT
- 數(shù)據(jù)源正在等待數(shù)據(jù)緩沖
MULTIMEDIA_SOURCE_STATUS_FAULT
MULTIMEDIA_SOURCE_STATUS_EOF
Enum: AudioChannelMask
CH_INVALID
CH_FRONT_LEFT
CH_FRONT_RIGHT
CH_FRONT_CENTER
CH_LOW_FREQUENCY
CH_BACK_LEFT
CH_BACK_RIGHT
CH_FRONT_LEFT_OF_CENTER
CH_FRONT_RIGHT_OF_CENTER
CH_BACK_CENTER
CH_SIDE_LEFT
CH_SIDE_RIGHT
CH_TOP_CENTER
CH_TOP_FRONT_LEFT
CH_TOP_FRONT_CENTER
CH_TOP_FRONT_RIGHT
CH_TOP_BACK_LEFT
CH_TOP_BACK_CENTER
CH_TOP_BACK_RIGHT
Enum: VideoColorFormat
VIDEO_COLOR_FORMAT_INVALID
VIDEO_COLOR_FORMAT_YUV420P
VIDEO_COLOR_FORMAT_YUV420SP
VIDEO_COLOR_FORMAT_YUV411P
VIDEO_COLOR_FORMAT_YUV411SP
更多建議: