setMediaFromFile method

Future<void> setMediaFromFile(
  1. File file, {
  2. bool? autoPlay,
  3. 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.) file - the File stream to start playing.

Implementation

Future<void> setMediaFromFile(
  File file, {
  bool? autoPlay,
  HwAcc? hwAcc,
}) async {
  _dataSourceType = DataSourceType.file;
  package = null;
  var dataSource = 'file://${file.path}';
  await _setStreamUrl(
    dataSource,
    dataSourceType: DataSourceType.file,
    package: null,
    autoPlay: autoPlay,
    hwAcc: hwAcc,
  );
}