Release a MediaPlayer instance and resources

You should release a MediaPlayer instance and resources when you no longer need the MediaResource.

When you release a MediaPlayer object, the underlying hardware resources that are associated with this MediaPlayer object are deallocated.

Here are some reasons to release a MediaPlayer:

  • Holding unnecessary resources can affect performance.
  • If multiple instances of the same video-codec are not supported on a device, playback failure might occur for other applications.
  1. Release the MediaPlayer.

    function release():void;
    

After the MediaPlayer instance is released, you can no longer use it. If any method of the MediaPlayer interface is called after it is released, an IllegalStateException is thrown.

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now