When does the Illegal_State event occur in the Android TVSDK

"Illegal_State generally comes when the player is not in the IDLE state. reset() is generally invoked before replaceCurrentResource() and the player should wait for reset() to get completed as the same contains the series of event, the player should wait to get that completed"

When you reset a MediaPlayer instance, it is returned to its uninitialized IDLE status as defined in MediaPlayerStatus.This operation is useful in the following cases:

You want to reuse a MediaPlayer instance but need to load a new MediaResource (video content) and replace the previous instance. Resetting allows you to reuse the MediaPlayer instance without the overhead of releasing resources, recreating the MediaPlayer, and reallocating resources. When the MediaPlayer is in ERROR status and needs to be cleared.

Important: This is the only way to recover from the ERROR status. Call reset to return the MediaPlayer instance to its uninitialized status: void reset() throws MediaPlayerException; 

Method: replaceCurrentResource() - The TVSDK provides the means to load and prepare content for playback by using the replaceCurrentResource method in MediaPlayer. This method takes two arguments, an instance of MediaPlayerResource and, optionally, an instance of MediaPlayerItemConfig, which you can use to pass application-defined custom parameters.  It is used when you want to reuse a MediaPlayer instance but needs to load a new MediaResource (video content) and replace the previous instance. Resetting allows you to reuse the MediaPlayer instance without the overhead of releasing resources, recreating the MediaPlayer, and reallocating resources.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy