chore(*): modernize the project
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
ThibaultBee
2026-02-04 15:13:10 +01:00
parent 529356a052
commit 5740e3f22b
15 changed files with 124 additions and 89 deletions

View File

@@ -18,5 +18,6 @@ See [StreamPack](https://github.com/ThibaultBee/StreamPack) for more settings an
1. Click on "Use this template" to create a new repository from this template.
2. Clone your new repository.
3. Open the project with Android Studio.
4. Set your RTMP or SRT server URL in `MainActivity.kt`.
4. Replace default `rtmp://my.server.url:1935/app/streamKey` by your RTMP or SRT server URL in
`MainViewModel.kt`.
5. Run the application on a device or an emulator.

View File

@@ -1,62 +0,0 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'io.github.thibaultbee.streampack.example'
compileSdk 36
defaultConfig {
applicationId "io.github.thibaultbee.streampack.example"
minSdk 26
targetSdk 36
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
packagingOptions {
jniLibs {
pickFirsts += ['**/*.so']
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.17.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'com.google.android.material:material:1.13.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation "io.github.thibaultbee.streampack:streampack-core:${streampackVersion}"
// For the `PreviewView`
implementation "io.github.thibaultbee.streampack:streampack-ui:${streampackVersion}"
// TODO: Only needed for RTMP live streaming: remove if you don't need it
implementation "io.github.thibaultbee.streampack:streampack-rtmp:${streampackVersion}"
// TODO: Only needed for SRT live streaming: remove if you don't need it
implementation "io.github.thibaultbee.streampack:streampack-srt:${streampackVersion}"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
}

65
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,65 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
android {
namespace = "io.github.thibaultbee.streampack.app"
compileSdk {
version = release(36)
}
defaultConfig {
applicationId = "io.github.thibaultbee.streampack.app"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_18
targetCompatibility = JavaVersion.VERSION_18
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_18)
}
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation(libs.streampack.core)
// For the `PreviewView`
implementation(libs.streampack.ui)
// TODO: Only needed for RTMP live streaming: remove if you don't need it
implementation(libs.streampack.rtmp)
// TODO: Only needed for SRT live streaming: remove if you don't need it
implementation(libs.streampack.srt)
implementation(libs.core.ktx)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.constraintlayout)
implementation(libs.lifecycle.runtime.ktx)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
}

View File

@@ -1,4 +1,4 @@
package io.github.thibaultbee.streampack.example
package io.github.thibaultbee.streampack.app
import android.content.pm.ActivityInfo

View File

@@ -1,4 +1,4 @@
package io.github.thibaultbee.streampack.example
package io.github.thibaultbee.streampack.app
import android.Manifest
import android.annotation.SuppressLint
@@ -9,12 +9,12 @@ import androidx.activity.viewModels
import androidx.annotation.RequiresPermission
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import io.github.thibaultbee.streampack.app.databinding.ActivityMainBinding
import io.github.thibaultbee.streampack.core.elements.sources.video.camera.extensions.defaultCameraId
import io.github.thibaultbee.streampack.core.streamers.lifecycle.StreamerActivityLifeCycleObserver
import io.github.thibaultbee.streampack.example.databinding.ActivityMainBinding
import io.github.thibaultbee.streampack.example.utils.PermissionsManager
import io.github.thibaultbee.streampack.example.utils.showDialog
import io.github.thibaultbee.streampack.example.utils.toast
import io.github.thibaultbee.streampack.app.utils.PermissionsManager
import io.github.thibaultbee.streampack.app.utils.showDialog
import io.github.thibaultbee.streampack.app.utils.toast
import kotlinx.coroutines.launch
class MainActivity : AppCompatActivity() {

View File

@@ -1,4 +1,4 @@
package io.github.thibaultbee.streampack.example
package io.github.thibaultbee.streampack.app
import android.Manifest
import android.media.AudioFormat

View File

@@ -1,4 +1,4 @@
package io.github.thibaultbee.streampack.example
package io.github.thibaultbee.streampack.app
import android.app.Application
import androidx.lifecycle.ViewModel

View File

@@ -1,4 +1,4 @@
package io.github.thibaultbee.streampack.example.utils
package io.github.thibaultbee.streampack.app.utils
import android.content.Context
import android.content.DialogInterface

View File

@@ -1,4 +1,4 @@
package io.github.thibaultbee.streampack.example.utils
package io.github.thibaultbee.streampack.app.utils
import android.content.pm.PackageManager
import androidx.activity.ComponentActivity

View File

@@ -1,12 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
// Upgrade StreamPack version here
streampackVersion = '3.1.1'
}
}
plugins {
id 'com.android.application' version '9.0.0' apply false
id 'org.jetbrains.kotlin.android' version '2.2.20' apply false
}

5
build.gradle.kts Normal file
View File

@@ -0,0 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}

31
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,31 @@
[versions]
agp = "9.0.0"
appcompat = "1.7.1"
constraintlayout = "2.2.1"
coreKtx = "1.17.0"
espressoCore = "3.7.0"
junit = "4.13.2"
junitVersion = "1.3.0"
kotlin = "2.3.0"
lifecycleRuntimeKtx = "2.10.0"
material = "1.13.0"
streampack = "3.1.1"
[libraries]
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
junit = { module = "junit:junit", version.ref = "junit" }
lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
material = { module = "com.google.android.material:material", version.ref = "material" }
streampack-core = { group = "io.github.thibaultbee.streampack", name = "streampack-core", version.ref = "streampack" }
streampack-ui = { group = "io.github.thibaultbee.streampack", name = "streampack-ui", version.ref = "streampack" }
streampack-rtmp = { group = "io.github.thibaultbee.streampack", name = "streampack-rtmp", version.ref = "streampack" }
streampack-srt = { group = "io.github.thibaultbee.streampack", name = "streampack-srt", version.ref = "streampack" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

View File

@@ -1,6 +1,6 @@
#Sun Mar 26 13:16:11 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@@ -1,8 +1,14 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
@@ -12,5 +18,6 @@ dependencyResolutionManagement {
mavenCentral()
}
}
rootProject.name = "MyStreamingApp"
include ':app'
include(":app")