native_audio_trimmer
FFmpeg를 사용하지 않고 안드로이드 및 iOS에서 오디오 파일을 자르는 데 사용할 수 있는 플러터 플러그인입니다.
Ajitcool008/native_audio_trimmer open-source repository details.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A Flutter plugin for trimming audio files on both Android and iOS platforms without using FFmpeg. This native audio editor provides powerful audio manipulation capabilities, perfect for Flutter audio trimming in apps, podcast trimming, and voice note editing.
Add this to your package's pubspec.yaml file:
dependencies:
native_audio_trimmer: ^1.0.0
Add the storage permissions to your AndroidManifest.xml if you're targeting Android 12 or below and need to access files outside of your app's directory:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
For Android 13+ (API level 33+), you may need to request more specific permissions depending on your use case:
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
No additional setup is required for iOS.
import 'package:native_audio_trimmer/native_audio_trimmer.dart';
// Create an instance of AudioTrimmer
final audioTrimmer = AudioTrimmer();
// Trim an audio file
try {
String inputPath = '/path/to/input.mp3';
String outputPath = '/path/to/output.m4a';
// Trim from 10 seconds to 30 seconds
// Trim audio
final trimmedFilePath = await NativeAudioTrimmer.trimAudio(
inputPath: inputPath,
outputPath: outputPath,
startTimeInSeconds: 10.0, // Start time in seconds,
endTimeInSeconds: 30.0, // End time in seconds,
);
print('Trimmed audio saved at: $trimmedFilePath');
} catch (e) {
print('Error trimming audio: $e');
}
Check out the example app in the example folder to see a complete implementation of audio file selection, trimming, and playback.
To run the example app:
cd example
flutter run
On iOS, this plugin uses the native AVAssetExportSession to perform audio trimming operations. The resulting audio file is saved in the .m4a format.
On Android, the plugin uses a combination of MediaExtractor, MediaCodec, and MediaMuxer to extract, process, and save the audio data between the specified start and end times.
Contributions are welcome! If you find a bug or want a feature, please open an issue on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
의존성 목록 3 개
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗