Skip to content

Can't play recorded track #35

@mtkgeek

Description

@mtkgeek

i keep getting the Failed assertion: line 309 pos 12: 'track != null': is not true. error whenever i try to play my recorded track using Quickplay.fromTrack().
Here's a snippet of my code

String recording;
Track track;
Future<void> startRecording() async {
    recording = Track.tempFile(WellKnownMediaFormats.adtsAac);
    track =
        Track.fromFile(recording, mediaFormat: WellKnownMediaFormats.adtsAac);

    recorder.onRequestPermissions = (_) => requestPermissions();
    try { 
      await recorder.record(track);
      print(recorder.isRecording);
} catch(e)
 {
print(e);     
    }
}

After recording with the above method then i call the method below

Future<void> stopRecording() async {
    try {
      print(recorder.isRecording);
    
      await recorder.stop();
      print(track);
    } catch (error) {
      print(error);
    } finally { 
      QuickPlay.fromTrack(track);    
    }
  }

Note: All methods are in the same class.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions