Skip to content

Need help understanding how to use decoder #15

@agbossi

Description

@agbossi

I'm trying to decode opus audio data by trying to copy that part of the example in the documentation. However I can't even get it to compile. I'm assuming I'm doing something wrong, but since it's practically a simplified copy, don't know what.

import 'package:opus_flutter/opus_flutter.dart' as opus_flutter;
import 'package:opus_dart/opus_dart.dart';

 static Future<Uint8List> decodeOpus(
    Stream<Uint8List> input, int sampleRate) async {
    List<Uint8List> output = [];
    await input.transform(StreamOpusDecoder.bytes(
          floatOutput: false,
          sampleRate: sampleRate,
          channels: 1,
          copyOutput: true,
          forwardErrorCorrection: false))
      .cast<Uint8List>()
      .forEach(output.add);
    return output[0];
  }

the error is

The argument type 'StreamOpusDecoder' can't be assigned to the parameter type 'StreamTransformer<Uint8List, dynamic>'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions