setMediaFromAsset method

Future<void> setMediaFromAsset(
  1. String dataSource, {
  2. String? package,
  3. bool? autoPlay,
  4. HwAcc? hwAcc,
})

This stops playback and changes the data source. Once the new data source has been loaded, the playback state will revert to its state before the method was called. (i.e. if this method is called whilst media is playing, once the new data source has been loaded, the new stream will begin playing.) dataSource - the path of the asset file.

Implementation

Future<void> setMediaFromAsset(
  String dataSource, {
  String? package,
  bool? autoPlay,
  HwAcc? hwAcc,
}) async {
  _dataSourceType = DataSourceType.asset;
  this.package = package;
  await _setStreamUrl(
    dataSource,
    dataSourceType: DataSourceType.asset,
    package: package,
    autoPlay: autoPlay,
    hwAcc: hwAcc,
  );
}