When playing a video in your Lens it's important to make sure that the video is ready before calling it, or that it's not already playing. Otherwise, you may see an error such as:
Calling play from invalid state
One easy way to make sure your video can be played and prevent the error is by doing a quick check before calling play:
if (provider.getStatus() != VideoStatus.Preparing) {
if (provider.getStatus() == VideoStatus.Playing) {
provider.stop();
}
if (provider.getStatus() != VideoStatus.Playing) {
provider.play(1);
}