setPlayerOption

Sets media player options.

int setPlayerOption(String key, int value);

This method sets media player options via key and value. Unlike setPlayerOptionString, the value parameter in this method is of type int, whereas in setPlayerOptionString it is of type String. These two methods cannot be used simultaneously. In general, you do not need to call this method and can use the default options provided by the media player.

Scenario

Applicable to scenarios requiring technical preview or custom features.

Timing

Call this method before calling the open or openWithMediaSource method.

Parameters

key
The key of the option.
value
The value of the option.

Return Values

  • 0: The method call succeeds.
  • < 0: The method call fails.