Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.1.0 (#unreleased)

- Feature [#468](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/pull/468) - Add macOS support
- Add Swift Package Manager support for iOS

## 2.0.2

Expand Down
31 changes: 21 additions & 10 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ group 'com.simform.audio_waveforms'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.8.20'
ext.kotlin_version = '2.4.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
classpath 'com.android.tools.build:gradle:9.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -22,22 +22,27 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

// AGP 9+ provides Kotlin support unless the consuming app explicitly opts out.
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int
def builtInKotlin = providers.gradleProperty("android.builtInKotlin")
.map { it.toBoolean() }
.orElse(agpMajor >= 9)
.get()
if (agpMajor < 9 || !builtInKotlin) {
apply plugin: 'kotlin-android'
}

android {
if (project.android.hasProperty("namespace")) {
namespace "com.simform.audio_waveforms"
}

compileSdk 34
compileSdk 36

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

sourceSets {
Expand All @@ -49,6 +54,12 @@ android {
}
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

dependencies {
implementation("androidx.multidex:multidex:2.0.1")
implementation "com.google.android.exoplayer:exoplayer:2.17.1"
Expand Down
2 changes: 0 additions & 2 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import FlutterMacOS
import Foundation

import audio_waveforms
import path_provider_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioWaveformsPlugin.register(with: registry.registrar(forPlugin: "AudioWaveformsPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
4 changes: 0 additions & 4 deletions ios/Classes/AudioWaveformsPlugin.h

This file was deleted.

15 changes: 0 additions & 15 deletions ios/Classes/AudioWaveformsPlugin.m

This file was deleted.

4 changes: 2 additions & 2 deletions ios/audio_waveforms.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ A new Flutter project.
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.source_files = 'audio_waveforms/Sources/audio_waveforms/**/*'
s.dependency 'Flutter'
s.platform = :ios, '8.0'
s.platform = :ios, '13.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
Expand Down
25 changes: 25 additions & 0 deletions ios/audio_waveforms/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "audio_waveforms",
platforms: [
.iOS("13.0")
],
products: [
.library(name: "audio-waveforms", targets: ["audio_waveforms"])
],
dependencies: [
.package(name: "FlutterFramework", path: "../FlutterFramework")
],
targets: [
.target(
name: "audio_waveforms",
dependencies: [
.product(name: "FlutterFramework", package: "FlutterFramework")
]
Comment on lines +14 to +22
)
]
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

import AVKit
import Flutter

class AudioPlayer: NSObject, AVAudioPlayerDelegate {
private var seekToStart = true
Expand All @@ -9,12 +9,12 @@ class AudioPlayer: NSObject, AVAudioPlayerDelegate {
private var player: AVAudioPlayer?
private var finishMode:FinishMode = FinishMode.stop
private var updateFrequency = 200
var plugin: SwiftAudioWaveformsPlugin
var plugin: AudioWaveformsPlugin
var playerKey: String
var flutterChannel: FlutterMethodChannel


init(plugin: SwiftAudioWaveformsPlugin, playerKey: String, channel: FlutterMethodChannel) {
init(plugin: AudioWaveformsPlugin, playerKey: String, channel: FlutterMethodChannel) {
self.plugin = plugin
self.playerKey = playerKey
flutterChannel = channel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AVFoundation
import Accelerate
import Flutter

public class AudioRecorder: NSObject, AVAudioRecorderDelegate{
var audioRecorder: AVAudioRecorder?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Flutter
import UIKit

public class SwiftAudioWaveformsPlugin: NSObject, FlutterPlugin {
public class AudioWaveformsPlugin: NSObject, FlutterPlugin {

let audioRecorder: AudioRecorder
var audioPlayers = [String: AudioPlayer]()
Expand All @@ -20,7 +20,7 @@ public class SwiftAudioWaveformsPlugin: NSObject, FlutterPlugin {
}
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: Constants.methodChannelName, binaryMessenger: registrar.messenger())
let instance = SwiftAudioWaveformsPlugin(registrar: registrar, flutterChannel: channel)
let instance = AudioWaveformsPlugin(registrar: registrar, flutterChannel: channel)
registrar.addMethodCallDelegate(instance, channel: channel)
}

Expand Down Expand Up @@ -216,4 +216,3 @@ public class SwiftAudioWaveformsPlugin: NSObject, FlutterPlugin {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import AVFAudio
import Accelerate
import Flutter

class RecorderBytesStreamEngine {
private var audioEngine = AVAudioEngine()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Accelerate
import AVFoundation
import Flutter

public class WaveformExtractor {

Expand Down