diff --git a/README.md b/README.md index fc86865..3c41dea 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index d0f3f2d..0000000 --- a/app/build.gradle +++ /dev/null @@ -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' -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..639681c --- /dev/null +++ b/app/build.gradle.kts @@ -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) +} \ No newline at end of file diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/ApplicationConstants.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/ApplicationConstants.kt similarity index 86% rename from app/src/main/java/io/github/thibaultbee/streampack/example/ApplicationConstants.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/ApplicationConstants.kt index 33773ad..e882eba 100644 --- a/app/src/main/java/io/github/thibaultbee/streampack/example/ApplicationConstants.kt +++ b/app/src/main/java/io/github/thibaultbee/streampack/app/ApplicationConstants.kt @@ -1,4 +1,4 @@ -package io.github.thibaultbee.streampack.example +package io.github.thibaultbee.streampack.app import android.content.pm.ActivityInfo diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/MainActivity.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/MainActivity.kt similarity index 95% rename from app/src/main/java/io/github/thibaultbee/streampack/example/MainActivity.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/MainActivity.kt index b689ab3..a39f3f6 100644 --- a/app/src/main/java/io/github/thibaultbee/streampack/example/MainActivity.kt +++ b/app/src/main/java/io/github/thibaultbee/streampack/app/MainActivity.kt @@ -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() { diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/MainViewModel.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/MainViewModel.kt similarity index 99% rename from app/src/main/java/io/github/thibaultbee/streampack/example/MainViewModel.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/MainViewModel.kt index b5b084a..9915382 100644 --- a/app/src/main/java/io/github/thibaultbee/streampack/example/MainViewModel.kt +++ b/app/src/main/java/io/github/thibaultbee/streampack/app/MainViewModel.kt @@ -1,4 +1,4 @@ -package io.github.thibaultbee.streampack.example +package io.github.thibaultbee.streampack.app import android.Manifest import android.media.AudioFormat diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/MainViewModelFactory.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/MainViewModelFactory.kt similarity index 97% rename from app/src/main/java/io/github/thibaultbee/streampack/example/MainViewModelFactory.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/MainViewModelFactory.kt index 1b94f62..64e03a8 100644 --- a/app/src/main/java/io/github/thibaultbee/streampack/example/MainViewModelFactory.kt +++ b/app/src/main/java/io/github/thibaultbee/streampack/app/MainViewModelFactory.kt @@ -1,4 +1,4 @@ -package io.github.thibaultbee.streampack.example +package io.github.thibaultbee.streampack.app import android.app.Application import androidx.lifecycle.ViewModel diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/data/rotation/RotationRepository.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/data/rotation/RotationRepository.kt similarity index 100% rename from app/src/main/java/io/github/thibaultbee/streampack/example/data/rotation/RotationRepository.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/data/rotation/RotationRepository.kt diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/utils/Extensions.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/utils/Extensions.kt similarity index 95% rename from app/src/main/java/io/github/thibaultbee/streampack/example/utils/Extensions.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/utils/Extensions.kt index aad0605..235cade 100644 --- a/app/src/main/java/io/github/thibaultbee/streampack/example/utils/Extensions.kt +++ b/app/src/main/java/io/github/thibaultbee/streampack/app/utils/Extensions.kt @@ -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 diff --git a/app/src/main/java/io/github/thibaultbee/streampack/example/utils/PermissionsManager.kt b/app/src/main/java/io/github/thibaultbee/streampack/app/utils/PermissionsManager.kt similarity index 97% rename from app/src/main/java/io/github/thibaultbee/streampack/example/utils/PermissionsManager.kt rename to app/src/main/java/io/github/thibaultbee/streampack/app/utils/PermissionsManager.kt index 5e313d8..4399371 100644 --- a/app/src/main/java/io/github/thibaultbee/streampack/example/utils/PermissionsManager.kt +++ b/app/src/main/java/io/github/thibaultbee/streampack/app/utils/PermissionsManager.kt @@ -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 diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 46321f4..0000000 --- a/build.gradle +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..7f09f7c --- /dev/null +++ b/build.gradle.kts @@ -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 +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..e97391f --- /dev/null +++ b/gradle/libs.versions.toml @@ -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" } + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ebcec8e..a807b7a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/settings.gradle b/settings.gradle.kts similarity index 55% rename from settings.gradle rename to settings.gradle.kts index 5c7ea80..1eba3ab 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -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")