Comments (3)
This plugin only extracts data from a file. It's up to you to get the data from other sources and save them to a file. Once you do so, this plugin is applicable after that point. I can't help you with how to read data from various sources, you will need to search for other plugins to do that or write a plugin that does that.
from just_waveform.
Thanks for reply. Yes, I write a plugin to do that, post here hope to help other guys.
Dart call
final exported = await AvAssetExportIos.instance.export(
ipodLibraryUri: song.data,
targetUri: iosExportFile.uri.toString(),
);
SwiftAvAssetExportIosPlugin.swift
import Flutter
import UIKit
import AVFoundation
import AVKit
import AssetsLibrary
public class SwiftAvAssetExportIosPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "av_asset_export_ios", binaryMessenger: registrar.messenger())
let instance = SwiftAvAssetExportIosPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
let args = call.arguments as? [String : Any?]
switch(call.method) {
case "export":
let ipodLibraryUri = args!["ipodLibraryUri"] as! String
let targetUri = args!["targetUri"] as! String
let assetURL = URL.init(string: ipodLibraryUri)!
let targetURL = URL.init(string: targetUri)!
export(assetURL, targetURL) { error in
print("[SwiftAvAssetExportIosPlugin] has error", error != nil)
result(error == nil)
}
break
default:
result(FlutterMethodNotImplemented)
}
}
func export(
_ assetURL: URL,
_ targetURL: URL,
completionHandler: @escaping (_ error: Error?) -> ()
) {
let asset = AVURLAsset(url: assetURL)
guard let exporter = AVAssetExportSession(
asset: asset,
presetName: AVAssetExportPresetAppleM4A
) else {
completionHandler(ExportError.unableToCreateExporter)
return
}
try? FileManager.default.removeItem(at: targetURL)
exporter.outputURL = targetURL
exporter.outputFileType = AVFileType.m4a
print("[SwiftAvAssetExportIosPlugin] exportAsynchronously assetURL: \(assetURL), outputURL: \(targetURL)");
exporter.exportAsynchronously {
switch(exporter.status) {
case .completed:
completionHandler(nil)
break
case .failed:
print(exporter.error!)
completionHandler(exporter.error)
break
default:
break
}
}
}
}
enum ExportError: Error {
case unableToCreateExporter
case unsupportedFormat
}
from just_waveform.
Related Issues (20)
- audio/waveform.mp3 must be an existed file? HOT 3
- Is it possible to extract audio from Stream? HOT 1
- Hide logs in console HOT 10
- Is there a way to draw waveform from Uint8List directly from buffer ? HOT 3
- Web support HOT 3
- Question: Cant follow along with example code HOT 1
- add support window HOT 9
- Waveform from a Stream<Uint8List> HOT 1
- PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null) HOT 3
- Frozen on 99% while generating. HOT 5
- How to cancel the waveform processing before done? HOT 2
- Example code load asset error HOT 5
- Detect silence and pauses within audio using the waveform generated HOT 7
- Align waveform bars to center HOT 1
- PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null) HOT 3
- just_audio integration HOT 3
- just_audio waveform design HOT 1
- Just audio wavefrom HOT 1
- %loading every reload on waveform HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from just_waveform.