Skip to content
Open
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
14 changes: 8 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
buildscript {

ext.kotlin_version = '1.5.32'
ext.exo_player_version = '2.18.1'
ext.kotlin_version = '1.8.0'
ext.exo_player_version = '2.18.2'

repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:7.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -29,7 +29,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -56,10 +56,12 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

implementation "org.greenrobot:eventbus:3.3.1"
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.10.1'

implementation "androidx.multidex:multidex:2.0.1"

implementation "com.google.android.exoplayer:exoplayer:$exo_player_version"
implementation "com.google.android.exoplayer:exoplayer-core:$exo_player_version"
implementation "com.google.android.exoplayer:exoplayer-ui:$exo_player_version"
implementation "com.google.android.exoplayer:exoplayer-hls:$exo_player_version"
implementation "com.google.android.exoplayer:extension-mediasession:$exo_player_version"
}
1 change: 0 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class FlutterRadioPlayerPlugin : FlutterPlugin, ActivityAware, MethodChannel.Met
Log.i(TAG, "::: Attaching to FRP to FlutterEngine :::")
this.context = context
frpChannel = MethodChannel(binaryMessenger, METHOD_CHANNEL_NAME)
frpChannel?.setMethodCallHandler(this)

val eventChannel = EventChannel(binaryMessenger, EVENT_CHANNEL_NAME)
eventChannel.setStreamHandler(object : EventChannel.StreamHandler {
Expand Down Expand Up @@ -121,15 +120,18 @@ class FlutterRadioPlayerPlugin : FlutterPlugin, ActivityAware, MethodChannel.Met
isBound = false
}
}
Log.i(TAG, "Binding service...")
flutterPluginBinding?.applicationContext?.bindService(serviceIntent, serviceConnection!!, Context.BIND_AUTO_CREATE)

context.bindService(serviceIntent, serviceConnection!!, Context.BIND_AUTO_CREATE)
frpChannel?.setMethodCallHandler(this)
}

@Subscribe(threadMode = ThreadMode.MAIN)
fun handleFRPEvents(event: FRPPlayerEvent) {
if (eventSink != null) {
Log.d(TAG, "FRP Event data = $event")
if (event.playbackStatus != null) {
// TODO reconsider unbinding service on stop because it might be too cumbersome to rebind it when resuming
if (event.playbackStatus == FRP_STOPPED) {
Log.i(TAG, "Service unbind....")
isBound = false
Expand All @@ -152,6 +154,7 @@ class FlutterRadioPlayerPlugin : FlutterPlugin, ActivityAware, MethodChannel.Met
}

override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
Log.i(TAG, ":::: received method call: ${call.method} ::::")
when (call.method) {
"init_service" -> {
if (isBound) {
Expand Down Expand Up @@ -219,7 +222,7 @@ class FlutterRadioPlayerPlugin : FlutterPlugin, ActivityAware, MethodChannel.Met
}
"seek_source_to_index" -> {
if (!isBound) {
result.error("FRP_008", "Failed to call prev_source", null)
result.error("FRP_008", "Failed to call seek_source_to_index", null)
throw FRPException("FRPCoreService has not been initialized yet")
}
val sourceIndex: Int = call.argument<Int>("source_index") ?: 0
Expand Down
Loading