The Tizen implementation of audioplayers
.
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.20.1
audioplayers_tizen: ^1.1.0
Then you can import audioplayers
in your Dart code:
import 'package:audioplayers/audioplayers.dart';
For detailed usage, see https://pub.dev/packages/audioplayers#usage.
To use this plugin in a Tizen application, you may need to declare the following privileges 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
) is required to play audio files located in the internal storage. - The externalstorage privilege (
http://tizen.org/privilege/externalstorage
) is required to play audio files located in the external storage. - The internet privilege (
http://tizen.org/privilege/internet
) is required to play any URLs from network.
For detailed information on Tizen privileges, see Tizen Docs: API Privileges.
-
AudioPlayer.play
(supported arguments:url
,volume
,position
) -
AudioPlayer.playBytes
(supported arguments:bytes
,volume
,position
) -
AudioPlayer.pause
-
AudioPlayer.stop
-
AudioPlayer.resume
-
AudioPlayer.release
-
AudioPlayer.seek
-
AudioPlayer.setVolume
-
AudioPlayer.setReleaseMode
-
AudioPlayer.setPlaybackRate
-
AudioPlayer.setUrl
(supported arguments:url
) -
AudioPlayer.getDuration
-
AudioPlayer.getCurrentPosition
-
AudioPlayer.dispose
-
AudioPlayer.earpieceOrSpeakersToggle
(not supported by Tizen) -
Logger.changeLogLevel
(not implemented) -
NotificationService
(iOS-only)
Note: In order to use the AudioPlayer.playBytes
method, you need to manually modify the source code (audioplayers.dart
) of your cached audioplayers package.
Future<int> playBytes(
Uint8List bytes, {
...
}) async {
// Delete or comment out the following lines.
// if (!_isAndroid()) {
// throw PlatformException(
// code: 'Not supported',
// message: 'Only Android is currently supported',
// );
// }
final result = await _invokeMethod(
'playBytes',
<String, dynamic>{
...
}
This plugin has some limitations on TV devices.
- The
setPlaybackRate
method will fail if triggered within last 3 seconds. - The playback rate will reset to 1.0 when audio is replayed in loop mode.
- The
seek
method works only when playback rate is 1.0, and it sets audio position to the nearest key frame which may differ from the passed argument.