audioplayers_tizen 1.0.0
audioplayers_tizen: ^1.0.0 copied to clipboard

Tizen implementation of the audioplayers plugin.

audioplayers_tizen #

The Tizen implementation of audioplayers.

Usage #

This package is not an endorsed implementation of audioplayers. Therefore, you have to include audioplayers_tizen alongside audioplayers as dependencies in your pubspec.yaml file.

dependencies:
  audioplayers: ^0.18.3
  audioplayers_tizen: ^1.0.0

Then you can import audioplayers in your Dart code:

import 'package:audioplayers/audio_cache.dart';
import 'package:audioplayers/audioplayers.dart';

For detailed usage, see https://github.com/luanpotter/audioplayers#usage.

Required privileges #

To use this plugin in a Tizen application, the mediastorage, externalstorage and internet privileges may be required. Add below lines under the <manifest> section in your tizen-manifest.xml file.

<privileges>
  <privilege>http://tizen.org/privilege/mediastorage</privilege>
  <privilege>http://tizen.org/privilege/externalstorage</privilege>
  <privilege>http://tizen.org/privilege/internet</privilege>
</privileges>
  • The mediastorage privilege (http://tizen.org/privilege/mediastorage) must be added to play audio files located in the internal storage.
  • The externalstorage privilege (http://tizen.org/privilege/externalstorage) must be added to play audio files located in the external storage.
  • The internet privilege (http://tizen.org/privilege/internet) must be added to play any URLs from network.

For details about Tizen privileges, see Security and API Privileges.

Some notes #

earpieceOrSpeakersToggle isn't supported on Tizen. AudioPlay will change stream routing automatically on Tizen, you can't choose speakers or earpiece.

AudioPlay supports playBytes on Tizen, to use this api, you have to modify the audioplayers.dart.

  Future<int> playBytes(
    Uint8List bytes, {
    double volume = 1.0,
    // position must be null by default to be compatible with radio streams
    Duration position,
    bool respectSilence = false,
    bool stayAwake = false,
    bool duckAudio = false,
    bool recordingActive = false,
  }) async {
    volume ??= 1.0;
    respectSilence ??= false;
    stayAwake ??= false;

    // To use this api on Tizen, you have to delete the following code
    ///if (!Platform.isAndroid) {
    ///  throw PlatformException(
    ///    code: 'Not supported',
    ///    message: 'Only Android is currently supported',
    ///  );
    ///}

    final int result = await _invokeMethod('playBytes', {
      'bytes': bytes,
      'volume': volume,
      'position': position?.inMilliseconds,
      'respectSilence': respectSilence,
      'stayAwake': stayAwake,
      'duckAudio': duckAudio,
      'recordingActive': recordingActive,
    });

    if (result == 1) {
      state = AudioPlayerState.PLAYING;
    }

    return result;
  }
0
likes
120
pub points
32%
popularity

Publisher

tizen.org

Tizen implementation of the audioplayers plugin.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on audioplayers_tizen