play method

Future<void> play(
  1. String url, {
  2. String title = "",
  3. String subtitle = "",
  4. Duration position = Duration.zero,
  5. bool isLiveStream = false,
})

Plays given url with native player. The title and subtitle are used for lock screen info panel on both iOS & Android. Optionally pass in current position to start playback from that point. The isLiveStream flag is only used on iOS to change the scrub-bar look on lock screen info panel. It has no affect on the actual functionality of the plugin. Defaults to false.

Implementation

Future<void> play(String url,
    {String title = "",
    String subtitle = "",
    Duration position = Duration.zero,
    bool isLiveStream = false}) async {
  if (_hasDataChanged(url, title, subtitle, position, isLiveStream)) {
    this._url = url;
    this._title = title;
    this._subtitle = subtitle;
    this._position = position;
    this._isLiveStream = isLiveStream;
    return _audioChannel.invokeMethod("play", <String, dynamic>{
      "url": url,
      "title": title,
      "subtitle": subtitle,
      "position": position.inMilliseconds,
      "isLiveStream": isLiveStream,
    });
  }
}