With the release of the Native SDK for Android version 6.18.0, there are some important changes to the SSAI Plugin that improve playback and seeking behavior, particularly in paused players.
Previously, when a user would seek forward and crossed an ad, the ad controls replaced the video controls immediately. This did not allow the user to keep seeking. The player would also keep the video content instead of replacing it with the ad content.
Now, users can seek forward and backward without the ads being played until the video is playing and the user has crossed an ad with the last seek.
Consider the following use case:
- The user loads a video with one or more mid-roll ads into the player and starts video playback.
- Before a mid-roll ad, the user pauses playback.
- While the player is paused, the user seeks across the mid-roll ad marker.
- While the player is still paused, the user seeks back across the mid-roll ad marker, back into the content just watched.
- After the seek, the player controls are available to the user. When the user presses Play, the content plays as expected.
- When playback reaches the midroll ad marker, the ad will play, with the ad controls displayed.
- After the midroll ad completes, the player completes the seek action to the seek target, where the content resumes playback, with the player controls.
The following requirements are needed for this feature:
- Brightcove Native SDK for Android 6.18.0 or higher
Plugin Behavioral Changes
The following classes have new behavior:
This class now passes the
BaseVideoView object to the
TimelineManager class when a reference to this is created.
It removed passing the references for the video playback controller and the ticker to the
SeekManager when this is created and, instead it passes the event emitter. It also sets the seek listener from the timeline manager object to this new
It also removed the
SeekManager object from being passed as an observer to the
This class is now public.
This class is now public.
This class no longer triggers the playback of ads. That functionality was moved to the
TimelineManager where it makes more sense.
This class previously listened for
SEEK_TO events and notified all the listeners subscribed to this class. With that action, it passed the new absolute time position and also emitted a new
SEEK_TO event including the absolute position and the relative position. Now,
SeekManager no longer emits a new seek event but still notifies all the listeners about the first seek event.
This class no longer implements the
SeekTask.Seekable classes and does not handle the events that those classes generate.
This class no longer handles
Skip Ad events.
The constructor signature has changed from
public SeekManager(VideoPlaybackController, Timeline, Ticker)
public SeekManager(EventEmitter, Timeline)
This class now handles the playback and skip action of ads. It is subscribed to the
SeekManager class to listen for seek events. Once a seek event is detected, this class checks if an ad was crossed. If so, it plays the ad. If not, it repositions the playhead in the video content and updates the absolute and relative positions.
The ads are played once the video is playing. If the video is paused, it will not play any ad crossed by seek events. This provides the availability to support many seek events. If the video is playing and an ad is crossed, the ad is played immediately.
When an ad is crossed while the video is paused, the
TimelineManager will resume the playhead position at the position before the ad was played.
TimelineManager resumes playback in the previous position when a skip ad event is detected.
The TimelineManager class now extends
In order to create a
TimelineManager object, you need to pass a
BaseVideoView instance along with a
The following classes have API changes:
This class was deleted because its main functionality was integrated into the
TimelineManager class where it makes more sense.
SeekManager(VideoPlaybackController videoPlaybackController, Timeline timeline, Ticker ticker) was deleted since it no longer needs the
VideoPlaybackController and the
Ticker. Instead, it now receives the
EventEmitter and the
Timeline as follows:
SeekManager(EventEmitter eventEmitter, Timeline timeline)
TimelineManager(@NonNull Timeline mTimeline) was changed to the following:
TimelineManager(@NonNull BaseVideoView mBaseVideoView, @NonNull Timeline mTimeline)