Starting Playback at Specific Position: Mobile SDK for Android

The following code snippet illustrates the Java for the final step in XDR: to play the video at a specific initial position.

Note: The function getInitialTime() shown here is a function you must write to retrieve the timestamp returned to your server. This variable is then passed to the method play().
.
.
.
OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer);
OoyalaPlayerLayoutController playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, PCODE, new PlayerDomain(DOMAIN));
player = playerLayoutController.getPlayer();
player.addObserver(this);
player.setEmbedCode(EMBED)

int initialTime = getInitialTime();
player.play(initialTime);
.
.
.

For more details about play(), see the documentation in the SDK package.

Was this article helpful?