1. 程式人生 > >Android7.0中文文件(API)--- VideoView

Android7.0中文文件(API)--- VideoView

VideoView


Displays a video file. The VideoView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.
播放一個視訊檔案。VideoView類可以從不同的源載入視訊(如資源或content provider),並負責計算從視訊中得到的尺寸,這樣它就可以在任何佈局管理器中使用,並提供各種顯示選項,例如縮放和著色。

Note: VideoView does not retain its full state when going into the background. In particular, it does not restore the current play state, play position, selected tracks, or any subtitle tracks added via . Applications should save and restore these on their own in and .
注意:VideoView進入後臺後,並不保留它的全部狀態。

特別是,它不會恢復當前的播放狀態,播放位置,選擇的視訊流,或任何通過新增的字幕。應用程式應該在它們自己的和方法中儲存和恢復這些狀態。

Also note that the audio session id (from ) may change from its previously returned value when the VideoView is restored.
同樣,請注意音訊會話id()也可能在VideoView恢復時改變先前返回的值。

摘要

Public方法

void

Adds an external subtitle source file (from the provided input stream.) Note that a single external subtitle source may contain multiple or no supported tracks in it.
新增一個外部字幕原始檔(InputStream引數)注意,單個外部字幕原始檔可能包含多個或不支援的字幕流。

void draw(Canvas canvas)

Manually render this view (and all of its children) to the given Canvas.
手動將此檢視 (及其所有子項) 渲染到指定的Canvas。

Return the class name of this object to be used for accessibility purposes.
返回此物件的類名,用於輔助功能目的。

int

Get the audio session id for the player used by this VideoView.
獲取該VideoView使用的播放器的音訊會話id。

boolean

Implement this method to handle touch screen motion events.
實現此方法,以處理觸控式螢幕的MotionEvent。

boolean

Implement this method to handle trackball motion events.
實現此方法,以處理滾跡球的MotionEvent。

void pause()
int resolveAdjustedSize(int desiredSize, int measureSpec)
void seekTo(int msec)
void

Sets which type of audio focus will be requested during the playback, or configures playback to not request audio focus.
設定在播放期間將會請求音訊焦點的型別,或者配置播放,而不是請求音訊焦點。

void

Register a callback to be invoked when the end of a media file has been reached during playback.
註冊一個回撥,當媒體檔案播放到末尾時呼叫。

void

Register a callback to be invoked when an error occurs during playback or setup.
註冊一個回撥,當播放或設定期間發生錯誤時呼叫。

void

Register a callback to be invoked when an informational event occurs during playback or setup.
註冊一個回撥,當播放或設定期間發生訊息事件時呼叫。

void

Register a callback to be invoked when the media file is loaded and ready to go.
註冊一個回撥,當媒體檔案被載入並準備播放時呼叫。

void

Sets video path.
設定視訊檔案的路徑。

void

Sets video URI using specific headers.
設定視訊的URI,其使用指定的頭部。

void

Sets video URI.
設定視訊的URI。

void start()

保護方法