# fluttertpc_just_audio **Repository Path**: openharmony-sig/fluttertpc_just_audio ## Basic Information - **Project Name**: fluttertpc_just_audio - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 4 - **Created**: 2024-11-11 - **Last Updated**: 2025-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ๐Ÿšจ **้‡่ฆๆ็คบ | IMPORTANT** > > **โš ๏ธ ๆญคไปฃ็ ไป“ๅทฒๅฝ’ๆกฃใ€‚ๆ–ฐๅœฐๅ€่ฏท่ฎฟ้—ฎ [fluttertpc_just_audio](https://gitcode.com/openharmony-sig/fluttertpc_just_audio)ใ€‚| โš ๏ธ This repository has been archived. For the new address, please visit [fluttertpc_just_audio](https://gitcode.com/openharmony-sig/fluttertpc_just_audio).** > --- > # just_audio_ohos https://pub.dev/packages/just_audio_ohos Flutter is a feature rich audio player. Loop through various audio formats and play any sound from any source (asset/file/URL/stream) for seamless playback. ## Installation First, add `just_audio_ohos` as a [dependency in your pubspec.yaml file](https://pub.dev/packages/just_audio_ohos). ```dart flutter pub add just_audio_ohos ``` Next, import 'just_audio_ohos.dart' into your dart code. ```dart import 'package:just_audio_ohos/just_audio_ohos.dart'; ``` ## Usage ```yaml dependencies: just_audio: 0.9.37 just_audio_ohos: 1.0.0 ``` ## Platform support | Feature | Android | Ohos | iOS | macOS | Web | Windows | Linux | | ------------------------------ | :-----: | :-----: | :--: | :---: | :--: | :-----: | :---: | | read from URL | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | read from file | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | read from asset | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | read from byte stream | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | request headers | โœ… | โœ… | โœ… | โœ… | | โœ… | โœ… | | DASH | โœ… | โœ… | | | | โœ… | โœ… | | HLS | โœ… | โœ… | โœ… | โœ… | | โœ… | โœ… | | ICY metadata | โœ… | | โœ… | โœ… | | | | | buffer status/position | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | play/pause/seek | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | set volume/speed | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | clip audio | โœ… | | โœ… | โœ… | โœ… | | โœ… | | playlists | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | looping/shuffling | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | compose audio | โœ… | | โœ… | โœ… | โœ… | | โœ… | | gapless playback | โœ… | โœ… | โœ… | โœ… | | โœ… | โœ… | | report player errors | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | handle phonecall interruptions | โœ… | โœ… | โœ… | | | | | | buffering/loading options | โœ… | โœ… | โœ… | โœ… | | | | | set pitch | โœ… | | | | | | | | skip silence | โœ… | | | | | | | | equalizer | โœ… | | | | | | โœ… | | volume boost | โœ… | | | | | | โœ… | ## Example ```dart import 'package:just_audio_ohos/just_audio_ohos.dart'; final _player = AudioPlayer(); await _player.setAudioSource(AudioSource.uri(Uri.parse( "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3"))); @override void dispose() { // Release decoders and buffers back to the operating system making them // available for other apps to use. _player.dispose(); super.dispose(); } SeekBar( duration: positionData?.duration ?? Duration.zero, position: positionData?.position ?? Duration.zero, bufferedPosition: positionData?.bufferedPosition ?? Duration.zero, onChangeEnd: _player.seek, ); // Opens volume slider dialog IconButton( icon: const Icon(Icons.volume_up), onPressed: () { showSliderDialog( context: context, title: "Adjust volume", divisions: 10, min: 0.0, max: 1.0, value: player.volume, stream: player.volumeStream, onChanged: player.setVolume, ); }, ), /// This StreamBuilder rebuilds whenever the player state changes, which /// includes the playing/paused state and also the /// loading/buffering/ready state. Depending on the state we show the /// appropriate button or loading indicator. StreamBuilder( stream: player.playerStateStream, builder: (context, snapshot) { final playerState = snapshot.data; final processingState = playerState?.processingState; final playing = playerState?.playing; if (processingState == ProcessingState.loading || processingState == ProcessingState.buffering) { return Container( margin: const EdgeInsets.all(8.0), width: 64.0, height: 64.0, child: const CircularProgressIndicator(), ); } else if (playing != true) { return IconButton( icon: const Icon(Icons.play_arrow), iconSize: 64.0, onPressed: player.play, ); } else if (processingState != ProcessingState.completed) { return IconButton( icon: const Icon(Icons.pause), iconSize: 64.0, onPressed: player.pause, ); } else { return IconButton( icon: const Icon(Icons.replay), iconSize: 64.0, onPressed: () => player.seek(Duration.zero), ); } }, ), // Opens speed slider dialog StreamBuilder( stream: player.speedStream, builder: (context, snapshot) => IconButton( icon: Text("${snapshot.data?.toStringAsFixed(1)}x", style: const TextStyle(fontWeight: FontWeight.bold)), onPressed: () { showSliderDialog( context: context, title: "Adjust speed", divisions: 10, min: 0.5, max: 1.5, value: player.speed, stream: player.speedStream, onChanged: player.setSpeed, ); }, ), ), ```