audioplayers_tizen 1.0.1 copy "audioplayers_tizen: ^1.0.1" to clipboard
audioplayers_tizen: ^1.0.1 copied to clipboard

outdated

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.1

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;
  }
3
likes
0
pub points
61%
popularity

Publisher

verified publishertizen.org

Tizen implementation of the audioplayers plugin.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on audioplayers_tizen