Overview
In earlier versions of the Brightcove Native SDK for Android, int and Integer data types were used to handle values for playhead position (including seek position) and video duration.
With the Native SDK for Android version 6.18.0, we have aligned with the ExoPlayer library for handling these values. The Native SDK has migrated from using int and Integer data types to long and Long data types.
Deprecation and replacement
This migration involves two processes:
- Deprecation of all
intandIntegerplayhead position and duration value references, in class members and methods - Creation of new class members and methods with a
Longpostfix on their names
Examples
Here are some examples of this deprecation and replacement:
In the ExoPlayerVideoDisplayComponent:
- Deprecated:
videoDisplayComponent.getLiveEdge() - New:
videoDisplayComponent.getLiveEdgeLong()
In the Video class:
- Deprecated:
video.getDuration() - New:
video.getDurationLong()
Requirements
The following requirements are needed for this feature:
- Brightcove Native SDK for Android 6.18.0 or higher
Using the new data types
Even though the Brightcove Native SDK for Android still supports the use of integer types, the replacement of these marks a breaking point for new releases. Therefore, we recommend implementing these replacements on your projects going forward.
Examples
Here are some examples of the new members and methods:
Listen for playhead position and video duration
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);
Get current playhead position
long position = event.getLongProperty(Event.PLAYHEAD_POSITION_LONG);
Or
long position = brightcoveVideoView.getVideoDisplay().getPlayerCurrentPosition();
Get video duration
long duration = videoView.getVideoDisplay().getCurrentVideo().getDurationLong();
Or
long duration = event.getLongProperty(Event.VIDEO_DURATION_LONG);
Deprecated classes and methods
The following class members and methods are now deprecated:
AbstractEvent class
PLAYHEAD_POSITIONPROGRESS_BAR_PLAYHEAD_POSITIONORIGINAL_PLAYHEAD_POSITIONVIDEO_DURATIONSEEK_DEFAULTSEEK_POSITIONSEEK_PROGRESSFROM_SEEK_POSITIONRESTORE_SEEK_POSITIONORIGINAL_SEEK_POSITIONMIN_POSITIONMAX_POSITIONLIVE_WINDOW_DURATIONSTART_TIMEEND_TIME
BaseVideoView class
durationplayheadPositiongetDuration()getCurrentPosition()seekTo(int position)
VideoDisplayComponent class
playheadPositiongetLiveEdge()
ExoPlayerVideoDisplayComponent class
getLiveEdge()
GooglecastComponent class
CAST_MEDIA_PLAY_POSITION
GoogleIMAComponent class
setAdPosition(int position)getContentPosition()setContentPosition(int position)
OmnitureComponent class
play(Integer position)play(Integer position, boolean shouldIgnoreState)stopPlayback(Integer position)stopPlayback(Integer position, boolean shouldIgnoreState)
BrightcoveClosedCaption class
Brightcove(int beginTime, int endTime, List<List<Span>> testLines)Brightcove(int beginTime, int endTime, String caption)getTimeRange()
TTMLParser class
parseTimeValue(String value)
BrightcoveMediaController class
getSeekBarOffset()
BrightcoveSeekBarController class
getSeekBarOffset()setSeekBarOffset(int offset)
MediaControllerConfig class
setInitialDuration(int initialDuration)setInitialPlayheadPosition(int initialPlayheadPosition)getInitialDuration()getInitialPlayheadPosition()
SeekButtonController class
seekDefaultseekStartPositionseekTargetPositiongetSeekDefault()setSeekDefault()computeTargetSeekPosition()
Block class
beginTimeendTimegetBeginTime()setBeginTime(Integer beginTime)getEndTime()setEndTime(Integer endTime)
CuePoint class
CuePointType(int position, String type, Map<String, Object> properties)CuePointType(int position, CuePointType type, Map<String, Object>)getPosition()
Video class
getDuration()
Video.Field class
duration
BrightcoveClosedCaptioningView class
TreeMap<Integer, ArrayList<TimeMapEntry>> captionsPerSecondMapSparseArray<StringBuilder> currentCaptionBlockArrayint lastProgressTimefindCaptionsForPosition(int position)refreshCaptions(int seekToTime)