概覽
在適用於 Android 的 Brightcove Native SDK 的早期版本中,int和Integer數據類型用於處理播放頭位置(包括搜索位置)和視頻持續時間的值。
借助適用於 Android 的 Native SDK 版本 6.18.0,我們已與ExoPlayer處理這些值的庫。本機 SDK 已從使用遷移int和Integer數據類型long和Long數據類型。
棄用和替換
此遷移涉及兩個過程:
- 全部棄用
int和Integer類成員和方法中的播放頭位置和持續時間值引用 - 創建新的類成員和方法
Long他們名字的後綴
範例
以下是此棄用和替換的一些示例:
在裡面ExoPlayerVideoDisplayComponent :
- 棄用:
videoDisplayComponent.getLiveEdge() - 新的:
videoDisplayComponent.getLiveEdgeLong()
在裡面Video班級:
- 棄用:
video.getDuration() - 新的:
video.getDurationLong()
需求
此功能需要滿足以下要求:
- 適用於 Android 6.18.0 或更高版本的 Brightcove Native SDK
使用新的數據類型
儘管適用於 Android 的 Brightcove Native SDK 仍然支持使用整數類型,但替換這些類型標誌著新版本的突破點。因此,我們建議在您未來的項目中實施這些替換。
範例
以下是新成員和方法的一些示例:
聆聽播放頭位置和視頻持續時間
Map<String, Object> properties = new HashMap<>();
properties.put(Event.PLAYHEAD_POSITION_LONG, exoPlayer.getCurrentPosition());
properties.put(Event.VIDEO, getCurrentVideo());
eventEmitter.emit(EventType.DID_STOP, properties);
獲取當前播放頭位置
long position = event.getLongProperty(Event.PLAYHEAD_POSITION_LONG);
或者
long position = brightcoveVideoView.getVideoDisplay().getPlayerCurrentPosition();
獲取視頻時長
long duration = videoView.getVideoDisplay().getCurrentVideo().getDurationLong();
或者
long duration = event.getLongProperty(Event.VIDEO_DURATION_LONG);
棄用的類和方法
現在不推薦使用以下類成員和方法:
AbstractEvent班級
PLAYHEAD_POSITIONPROGRESS_BAR_PLAYHEAD_POSITIONORIGINAL_PLAYHEAD_POSITIONVIDEO_DURATIONSEEK_DEFAULTSEEK_POSITIONSEEK_PROGRESSFROM_SEEK_POSITIONRESTORE_SEEK_POSITIONORIGINAL_SEEK_POSITIONMIN_POSITIONMAX_POSITIONLIVE_WINDOW_DURATIONSTART_TIMEEND_TIME
BaseVideoView班級
durationplayheadPositiongetDuration()getCurrentPosition()seekTo(int position)
VideoDisplayComponent班級
playheadPositiongetLiveEdge()
ExoPlayerVideoDisplayComponent班級
getLiveEdge()
GooglecastComponent班級
CAST_MEDIA_PLAY_POSITION
GoogleIMAComponent班級
setAdPosition(int position)getContentPosition()setContentPosition(int position)
OmnitureComponent班級
play(Integer position)play(Integer position, boolean shouldIgnoreState)stopPlayback(Integer position)stopPlayback(Integer position, boolean shouldIgnoreState)
BrightcoveClosedCaption班級
Brightcove(int beginTime, int endTime, List<List<Span>> testLines)Brightcove(int beginTime, int endTime, String caption)getTimeRange()
TTMLParser班級
parseTimeValue(String value)
BrightcoveMediaController班級
getSeekBarOffset()
BrightcoveSeekBarController班級
getSeekBarOffset()setSeekBarOffset(int offset)
MediaControllerConfig班級
setInitialDuration(int initialDuration)setInitialPlayheadPosition(int initialPlayheadPosition)getInitialDuration()getInitialPlayheadPosition()
SeekButtonController班級
seekDefaultseekStartPositionseekTargetPositiongetSeekDefault()setSeekDefault()computeTargetSeekPosition()
Block班級
beginTimeendTimegetBeginTime()setBeginTime(Integer beginTime)getEndTime()setEndTime(Integer endTime)
CuePoint班級
CuePointType(int position, String type, Map<String, Object> properties)CuePointType(int position, CuePointType type, Map<String, Object>)getPosition()
Video班級
getDuration()
Video.Field班級
duration
BrightcoveClosedCaptioningView班級
TreeMap<Integer, ArrayList<TimeMapEntry>> captionsPerSecondMapSparseArray<StringBuilder> currentCaptionBlockArrayint lastProgressTimefindCaptionsForPosition(int position)refreshCaptions(int seekToTime)