setMedia method

void setMedia(
  1. String uri,
  2. MediaType type
)

Set media of type. Can be used to load external audio track and subtitle file. An external media can contains other MediaType tracks although they will not be used. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setmediaconst-char-url-mediatype-type

Implementation

void setMedia(String uri, MediaType type) {
  final cs = uri.toNativeUtf8();
  _player.ref.setMediaForType
      .asFunction<void Function(Pointer<mdkPlayer>, Pointer<Char>, int)>()(
    _player.ref.object,
    cs.cast(),
    type.rawValue,
  );
  malloc.free(cs);
}