getMusicDurationInMS method

Future<int?> getMusicDurationInMS(
  1. String path
)

Get the total duration of the background music file in milliseconds

Parameters:

path Path of the music file. If the path parameter is empty, the duration of the music file being played back will be returned.

Returned value: the music duration will be returned if this API is successfully called; otherwise, -1 will be returned

Platform not supported:

  • web

Implementation

Future<int?> getMusicDurationInMS(String path) {
  return _channel.invokeMethod('getMusicDurationInMS', {"path": path});
}