Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to Android SDK up 34. #207

Merged
merged 2 commits into from
Jan 2, 2024
Merged
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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -17,7 +17,7 @@ android {
defaultConfig {
applicationId "com.haishinkit.app"
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/haishinkit/app/Preference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.haishinkit.app
data class Preference(var rtmpURL: String, var streamName: String) {
companion object {
var shared = Preference(
"rtmp://test:[email protected].9/live",
"rtmp://test:[email protected].3/live",
"live"
)

Expand Down
6 changes: 3 additions & 3 deletions haishinkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka'

task sourceJar(type: Jar) {
tasks.register('sourceJar', Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set("sources")
}

android {
namespace 'com.haishinkit'
compileSdkVersion 33
compileSdk 34
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
buildConfigField "String", "VERSION_NAME", "\"${rootProject.ext.version_name}\""
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ class MediaProjectionSource(
override var utilizable: Boolean = false
) :
VideoSource {

private class Callback : MediaProjection.Callback() {
override fun onCapturedContentVisibilityChanged(isVisible: Boolean) {
super.onCapturedContentVisibilityChanged(isVisible)
Log.d(TAG, "Callback#onCapturedContentVisibilityChanged")
}

override fun onCapturedContentResize(width: Int, height: Int) {
super.onCapturedContentResize(width, height)
Log.d(TAG, "Callback#onCapturedContentResize")
}

override fun onStop() {
super.onStop()
Log.d(TAG, "Callback#onStop")
}
}

/**
* Specifies scale that defines a transformation that resizes an image.
*/
Expand Down Expand Up @@ -124,6 +142,8 @@ class MediaProjectionSource(
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P)
private var isAvailableRotatesWithContentFlag = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P

private val callback: Callback by lazy { Callback() }

override fun setUp() {
if (utilizable) return
val windowManager =
Expand All @@ -132,6 +152,8 @@ class MediaProjectionSource(
if (isRotatesWithContent) {
orientationEventListener?.enable()
}
// Android 14 must register an callback.
mediaProjection.registerCallback(callback, null)
rotation = windowManager.defaultDisplay.rotation
resolution =
Size((metrics.widthPixels * scale).toInt(), (metrics.heightPixels * scale).toInt())
Expand All @@ -143,6 +165,7 @@ class MediaProjectionSource(
if (isRotatesWithContent) {
orientationEventListener?.disable()
}
mediaProjection.unregisterCallback(callback)
mediaProjection.stop()
super.tearDown()
}
Expand All @@ -167,13 +190,15 @@ class MediaProjectionSource(
/**
* Register a listener to receive notifications about when the MediaProjection changes state.
*/
@Suppress("UNUSED")
fun registerCallback(callback: MediaProjection.Callback, handler: Handler?) {
mediaProjection.registerCallback(callback, handler)
}

/**
* Unregister a MediaProjection listener.
*/
@Suppress("UNUSED")
fun unregisterCallback(callback: MediaProjection.Callback) {
mediaProjection.unregisterCallback(callback)
}
Expand Down
4 changes: 2 additions & 2 deletions vulkan/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apply plugin: 'org.jetbrains.dokka'

android {
namespace 'com.haishinkit.vulkan'
compileSdkVersion 33
compileSdk 34

defaultConfig {
minSdkVersion 26
targetSdkVersion 33
targetSdkVersion 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Loading