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
int
andInteger
playhead position and duration value references, in class members and methods - Creation of new class members and methods with a
Long
postfix 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_POSITION
PROGRESS_BAR_PLAYHEAD_POSITION
ORIGINAL_PLAYHEAD_POSITION
VIDEO_DURATION
SEEK_DEFAULT
SEEK_POSITION
SEEK_PROGRESS
FROM_SEEK_POSITION
RESTORE_SEEK_POSITION
ORIGINAL_SEEK_POSITION
MIN_POSITION
MAX_POSITION
LIVE_WINDOW_DURATION
START_TIME
END_TIME
BaseVideoView
class
duration
playheadPosition
getDuration()
getCurrentPosition()
seekTo(int position)
VideoDisplayComponent
class
playheadPosition
getLiveEdge()
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
seekDefault
seekStartPosition
seekTargetPosition
getSeekDefault()
setSeekDefault()
computeTargetSeekPosition()
Block
class
beginTime
endTime
getBeginTime()
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>> captionsPerSecondMap
SparseArray<StringBuilder> currentCaptionBlockArray
int lastProgressTime
findCaptionsForPosition(int position)
refreshCaptions(int seekToTime)