Last active
December 24, 2015 16:29
-
-
Save animecyc/6828874 to your computer and use it in GitHub Desktop.
HLS Seeking - Android Brightcove SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For reference here are the vars being used | |
// | |
// protected final BrightcoveVideoView videoPlayer; | |
// protected final EventEmitter eventEmitter = new EventEmitterImpl(); | |
// private int shouldSeekTo = 0; | |
// private boolean correctingPlayPosition = false; | |
videoPlayer = new BrightcoveVideoView(context) { | |
@Override | |
public void seekTo(int msec) | |
{ | |
if (msec != shouldSeekTo || correctingPlayPosition) | |
{ | |
if (correctingPlayPosition) | |
{ | |
msec -= 1000; | |
if (msec < 0) | |
{ | |
msec = 0; | |
} | |
} | |
super.seekTo(msec); | |
} | |
shouldSeekTo = msec; | |
} | |
}; | |
videoPlayer.setEventEmitter(eventEmitter); | |
eventEmitter.on(EventType.DID_SEEK_TO, new EventListener() { | |
@Override | |
public void processEvent(Event event) { | |
if (shouldSeekTo != videoPlayer.getCurrentPosition()) | |
{ | |
correctingPlayPosition = true; | |
videoPlayer.seekTo(shouldSeekTo); | |
} | |
else | |
{ | |
correctingPlayPosition = false; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment