diff --git a/demos/effect/README.md b/demos/effect/README.md new file mode 100644 index 0000000000..5bf4c7fc30 --- /dev/null +++ b/demos/effect/README.md @@ -0,0 +1,7 @@ +# Effect demo + +This app demonstrates how to use the [Effect][] API to modify videos. It uses +[setVideoEffects] method to add different effects to [ExoPlayer]. + +See the [demos README](../README.md) for instructions on how to build and run +this demo. diff --git a/demos/effect/build.gradle b/demos/effect/build.gradle new file mode 100644 index 0000000000..7d7ec62d33 --- /dev/null +++ b/demos/effect/build.gradle @@ -0,0 +1,79 @@ +// Copyright 2024 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +apply from: '../../constants.gradle' +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +android { + namespace 'androidx.media3.demo.effect' + + compileSdk project.ext.compileSdkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + defaultConfig { + versionName project.ext.releaseVersion + versionCode project.ext.releaseVersionCode + minSdkVersion project.ext.minSdkVersion + targetSdkVersion project.ext.appTargetSdkVersion + } + + buildTypes { + release { + shrinkResources true + minifyEnabled true + signingConfig signingConfigs.debug + } + debug { + jniDebuggable = true + } + } + + lintOptions { + // The demo app isn't indexed, and doesn't have translations. + disable 'GoogleAppIndexingWarning','MissingTranslation' + } + buildFeatures { + compose true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.3" + } + + testOptions { + unitTests { + includeAndroidResources = true + } + } +} + +dependencies { + def composeBom = platform('androidx.compose:compose-bom:2024.10.00') + implementation composeBom + + implementation 'androidx.activity:activity-compose:1.9.3' + implementation 'androidx.compose.foundation:foundation-android:1.7.4' + implementation 'androidx.compose.material3:material3-android:1.3.0' + implementation 'com.google.android.material:material:' + androidxMaterialVersion + + // For detecting and debugging leaks only. LeakCanary is not needed for demo app to work. + debugImplementation 'com.squareup.leakcanary:leakcanary-android:' + leakCanaryVersion +} diff --git a/demos/effect/src/main/AndroidManifest.xml b/demos/effect/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..f85a8a2ec7 --- /dev/null +++ b/demos/effect/src/main/AndroidManifest.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + diff --git a/demos/effect/src/main/java/androidx/media3/demo/effect/EffectActivity.kt b/demos/effect/src/main/java/androidx/media3/demo/effect/EffectActivity.kt new file mode 100644 index 0000000000..bb6de7a07c --- /dev/null +++ b/demos/effect/src/main/java/androidx/media3/demo/effect/EffectActivity.kt @@ -0,0 +1,47 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package androidx.media3.demo.effect + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign + +class EffectActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + Surface(modifier = Modifier.fillMaxSize()) { + Column( + modifier = Modifier.fillMaxWidth(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text(text = "Effect demo", textAlign = TextAlign.Center) + } + } + } + } +} diff --git a/demos/effect/src/main/res/mipmap-hdpi/ic_launcher.png b/demos/effect/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..adaa93220e Binary files /dev/null and b/demos/effect/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/demos/effect/src/main/res/mipmap-mdpi/ic_launcher.png b/demos/effect/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..9b6f7d5e80 Binary files /dev/null and b/demos/effect/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/demos/effect/src/main/res/mipmap-xhdpi/ic_launcher.png b/demos/effect/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..2101026c9f Binary files /dev/null and b/demos/effect/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/demos/effect/src/main/res/mipmap-xxhdpi/ic_launcher.png b/demos/effect/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..223ec8bd11 Binary files /dev/null and b/demos/effect/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/demos/effect/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/demos/effect/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..698ed68c42 Binary files /dev/null and b/demos/effect/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/demos/effect/src/main/res/values-night/themes.xml b/demos/effect/src/main/res/values-night/themes.xml new file mode 100644 index 0000000000..81d099a092 --- /dev/null +++ b/demos/effect/src/main/res/values-night/themes.xml @@ -0,0 +1,31 @@ + + + + + + diff --git a/demos/effect/src/main/res/values/colors.xml b/demos/effect/src/main/res/values/colors.xml new file mode 100644 index 0000000000..b6cddca2d3 --- /dev/null +++ b/demos/effect/src/main/res/values/colors.xml @@ -0,0 +1,24 @@ + + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + diff --git a/demos/effect/src/main/res/values/strings.xml b/demos/effect/src/main/res/values/strings.xml new file mode 100644 index 0000000000..d650835c4c --- /dev/null +++ b/demos/effect/src/main/res/values/strings.xml @@ -0,0 +1,18 @@ + + + + Effect Demo + diff --git a/demos/effect/src/main/res/values/themes.xml b/demos/effect/src/main/res/values/themes.xml new file mode 100644 index 0000000000..bdbdbbe80a --- /dev/null +++ b/demos/effect/src/main/res/values/themes.xml @@ -0,0 +1,31 @@ + + + + + + diff --git a/settings.gradle b/settings.gradle index 017d8cde9b..f4803b7513 100644 --- a/settings.gradle +++ b/settings.gradle @@ -35,6 +35,8 @@ include modulePrefix + 'demo-compose' project(modulePrefix + 'demo-compose').projectDir = new File(rootDir, 'demos/compose') include modulePrefix + 'demo-composition' project(modulePrefix + 'demo-composition').projectDir = new File(rootDir, 'demos/composition') +include modulePrefix + 'demo-effect' +project(modulePrefix + 'demo-effect').projectDir = new File(rootDir, 'demos/effect') include modulePrefix + 'demo-gl' project(modulePrefix + 'demo-gl').projectDir = new File(rootDir, 'demos/gl') include modulePrefix + 'demo-session'