Skip to content

Commit

Permalink
Feature/issue 161/media3 - Migrated to use the androidx.media3 Library (
Browse files Browse the repository at this point in the history
#162)

feat(media3): Migrated to use androidx.media3

BREAKING CHANGE: Many core classes have now been reimplemented.
  • Loading branch information
goldy1992 authored Nov 6, 2022
1 parent f31c5f0 commit c8030cd
Show file tree
Hide file tree
Showing 247 changed files with 5,184 additions and 3,238 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/github-semantic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ jobs:
runs-on: ubuntu-latest
environment: release_env
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.5.1
with:
node-version: 16

- name: Set up Python 3.9
uses: actions/setup-python@v3.1.2
uses: actions/setup-python@v4.3.0
with:
python-version: 3.9

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/google-play-store-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ jobs:
runs-on: ubuntu-latest
environment: release_env
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3.3.0
uses: actions/setup-java@v3.6.0
with:
distribution: corretto
java-version: 11

- name: Cache Gradle packages
uses: actions/[email protected].2
uses: actions/[email protected].11
with:
path: |
~/.gradle/caches
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/master-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@ jobs:
environment: release_env
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3.3.0
uses: actions/setup-java@v3.6.0
with:
distribution: corretto
java-version: 11

- name: Cache Gradle packages
uses: actions/[email protected].2
uses: actions/[email protected].11
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle


- name: Cache SonarCloud packages
uses: actions/[email protected].2
uses: actions/[email protected].11
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v2.0.10

- name: Make gradlew executable
run: chmod +x ./gradlew
Expand All @@ -55,7 +55,7 @@ jobs:


- name: Setup gcloud
uses: google-github-actions/[email protected].0
uses: google-github-actions/[email protected].2

- name: Run firebase tests on gcloud and pull coverage data
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/master-trigger-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
GITHUB_CONTEXT: ${{ toJson(github) }}
QUALITY_GATE_PASSED: 0
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0

- name: Dump GitHub context into event.json
run: echo $GITHUB_CONTEXT | tee event.json;

- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4.3.0
with:
python-version: 3.9

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull-requests-to-master-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ jobs:
run-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3.3.0
uses: actions/setup-java@v3.6.0
with:
distribution: corretto
java-version: 11
- name: Cache Gradle packages
uses: actions/[email protected].2
uses: actions/[email protected].11
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Cache SonarCloud packages
uses: actions/[email protected].2
uses: actions/[email protected].11
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v2.0.10
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- Developed using the design principles in [Google's Android Audio App](https://developer.android.com/guide/topics/media-apps/audio-app/building-an-audio-app) tutorial.

## Features
- Implementation of a [Media Browser Service](https://developer.android.com/guide/topics/media-apps/audio-app/building-a-mediabrowserservice.html), a [Media Browser Client](https://developer.android.com/guide/topics/media-apps/audio-app/building-a-mediabrowser-client.html) and the respective [Media Session Callbacks](https://developer.android.com/guide/topics/media-apps/audio-app/mediasession-callbacks.html).
- Makes use of the AndroidX [Media3 Library](https://developer.android.com/guide/topics/media/media3).
- Dynamic loading of content using a [Content Resolver](https://developer.android.com/guide/topics/providers/content-provider-basics) on the Android [MediaStore](https://developer.android.com/reference/android/provider/MediaStore).
- Change of playback speed and different implementations to support different versions on the Android [MediaPlayer](https://developer.android.com/reference/android/media/MediaPlayer).
- Written in [Jetpack Compose](https://developer.android.com/jetpack/compose).
Expand Down
17 changes: 3 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,14 @@ android {
dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation group: 'org.apache.commons', name: 'commons-lang3', version: commons_lang_version
implementation group: 'org.apache.commons', name: 'commons-collections4', version: commons_collections4_version
implementation group: 'androidx.media', name: 'media', version: media_version
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: coroutines_version
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-android', version: coroutines_version
implementation group: 'com.google.android.exoplayer', name: 'exoplayer-ui', version: exo_player_vesrion
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlin_version
implementation group: 'androidx.core', name: 'core-ktx', version: androidx_core_ktx_version
implementation group: 'androidx.appcompat', name: 'appcompat', version: app_compat_version
implementation group: 'com.google.android.exoplayer', name: 'exoplayer-core', version: exo_player_vesrion
implementation group: 'com.google.android.exoplayer', name: 'extension-mediasession', version: exo_player_vesrion
implementation group: 'androidx.room', name: 'room-runtime', version: room_version

// local libs
implementation project(path: ':commons')
implementation project(path: ':service')
implementation project(path: ':client')

implementation group: 'androidx.activity', name: 'activity-ktx', version: activity_ktx_version
debugImplementation group: 'androidx.core', name: 'core-ktx', version: androidx_core_ktx_version
// hilt
implementation group: 'com.google.dagger', name: 'hilt-android', version: hilt_version
kapt group: 'com.google.dagger', name: 'hilt-android-compiler', version: hilt_version
Expand Down Expand Up @@ -154,9 +144,8 @@ dependencies {



debugImplementation group: 'androidx.core', name: 'core-ktx', version: androidx_core_ktx_version

implementation group: 'androidx.activity', name: 'activity-ktx', version: activity_ktx_version


}

Expand Down
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
buildscript {
ext {
min_sdk_version = 23
target_sdk_version = 31
target_sdk_version = 33
build_tools_version = '30.0.3'
kotlin_version = '1.6.10'
kotlin_version = '1.7.20'
activity_ktx_version = '1.2.4'
androidx_core_ktx_version = '1.3.2'
annotation_version = '1.1.0-rc01'
app_compat_version = '1.3.1'
commons_collections4_version = '4.4'
commons_io_version = '1.3.2'
commons_lang_version = '3.9'
compose_version = '1.1.1'
compose_material3_version = '1.0.0-alpha11'
compose_version = '1.3.0'
compose_material3_version = '1.0.0'
compose_test_version = '1.0.4'
datastore_preferences_version = '1.0.0'
espresso_core_version = '3.3.0'
exo_player_vesrion = '2.17.1'
hilt_version = '2.42'
jacoco_version = '0.8.7'
junit_ext_version = '1.1.2'
junit4_version = '4.12'
lifecycle_version = '2.4.1'
coroutines_version = '1.4.2'
media_version = '1.6.0'
lifecycle_version = '2.5.1'
coroutines_version = '1.6.4'
media3_version = '1.0.0-beta02'
monitor_version = '1.4.0-beta01'
mockito_inline_version = '3.7.7'
mockito_kotlin_version = '3.2.0'
Expand Down Expand Up @@ -64,7 +64,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
}
Expand Down
66 changes: 26 additions & 40 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerExtensionVersion '1.3.2'
}
packagingOptions {
resources {
Expand All @@ -40,7 +40,7 @@ android {
}
debug {
testCoverageEnabled true
enableUnitTestCoverage false
enableUnitTestCoverage true
minifyEnabled false
}

Expand All @@ -52,23 +52,6 @@ android {
}
}

sourceSets {
String sharedTestSrcDir = 'src/testCommons/java'
String sharedTestResDir = 'src/testCommons/res'
full {
debug {
test {
java.srcDirs += [sharedTestSrcDir]
resources.srcDirs += [sharedTestResDir]
}
androidTest {
java.srcDirs += [sharedTestSrcDir]
resources.srcDirs += [sharedTestResDir]
}
}
}
}

compileOptions {
incremental = false
sourceCompatibility JavaVersion.VERSION_11
Expand All @@ -77,11 +60,13 @@ android {

kotlinOptions {
jvmTarget = "11"
useIR = true
}
testFixtures {
enable true
}

testOptions {
//execution 'ANDROIDX_TEST_ORCHESTRATOR'
testOptions {
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
animationsDisabled true

unitTests {
Expand Down Expand Up @@ -124,13 +109,11 @@ dependencies {
implementation group: 'androidx.annotation', name: 'annotation', version: annotation_version
implementation group: 'androidx.appcompat', name: 'appcompat', version: app_compat_version
implementation group: 'androidx.core', name: 'core-ktx', version: androidx_core_ktx_version
implementation group: 'androidx.media', name: 'media', version: media_version
implementation group: 'androidx.media3', name: 'media3-session', version: media3_version
implementation group: 'org.apache.commons', name: 'commons-io', version: commons_io_version
implementation group: 'org.apache.commons', name: 'commons-collections4', version: commons_collections4_version
implementation group: 'org.apache.commons', name: 'commons-lang3', version: commons_lang_version

implementation group: 'androidx.lifecycle', name: 'lifecycle-runtime-ktx', version: lifecycle_version
implementation group: 'androidx.lifecycle', name: 'lifecycle-livedata-ktx', version: lifecycle_version
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-savedstate', version: lifecycle_version
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-ktx', version: lifecycle_version
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-compose', version: lifecycle_version
Expand All @@ -150,26 +133,24 @@ dependencies {
implementation group: 'androidx.compose.material', name:'material-icons-core', version: compose_version
implementation group: 'androidx.compose.material', name:'material-icons-extended', version: compose_version
implementation group: 'androidx.compose.material3', name: 'material3', version: compose_material3_version
//implementation group: 'androidx.compose.material3', name: 'material3-window-size-class', version: compose_material3_version
implementation group: 'androidx.compose.material3', name: 'material3-window-size-class', version: compose_material3_version

implementation group: 'androidx.compose.runtime', name: 'runtime-livedata', version: compose_version
implementation group: 'androidx.compose.runtime', name: 'runtime-rxjava2', version: compose_version
implementation group: 'androidx.concurrent', name: 'concurrent-futures-ktx', version: '1.1.0'
implementation group: 'androidx.activity', name: 'activity-compose', version: '1.6.1'

implementation group: 'androidx.activity', name: 'activity-compose', version: '1.4.0'

implementation "androidx.navigation:navigation-compose:2.5.0-rc01"
// implementation "androidx.navigation:navigation-compose:2.5.0-rc01"
implementation group: 'com.google.dagger', name: 'hilt-android', version: hilt_version
implementation group: 'androidx.hilt', name: 'hilt-navigation-compose', version: '1.0.0'

def accompanist_version = '0.23.0'
def accompanist_version = '0.27.0'
implementation group: "com.google.accompanist", name: "accompanist-pager", version: accompanist_version
implementation group: "com.google.accompanist", name: "accompanist-insets", version: accompanist_version
implementation group: "com.google.accompanist", name: "accompanist-pager-indicators", version: accompanist_version
implementation group: "com.google.accompanist", name: "accompanist-navigation-animation", version: accompanist_version
implementation group: "io.coil-kt", name: "coil-compose", version: "1.3.2"

implementation "androidx.window:window:1.0.0-beta04"

def datastore_preferences_version = '1.0.0'
implementation group: "androidx.datastore", name: "datastore-preferences", version: datastore_preferences_version

// UI Tests
Expand All @@ -183,19 +164,19 @@ dependencies {
// hilt
kapt group: 'com.google.dagger', name: 'hilt-android-compiler', version: hilt_version
kapt group: 'com.google.dagger', name: 'hilt-compiler', version: hilt_version


kaptTest group: 'com.google.dagger', name: 'hilt-android-compiler', version: hilt_version
kaptTest group: 'com.google.dagger', name: 'hilt-compiler', version: hilt_version
kaptTestFixtures group: 'com.google.dagger', name: 'hilt-android-compiler', version: hilt_version
kaptTestFixtures group: 'com.google.dagger', name: 'hilt-compiler', version: hilt_version

androidTestImplementation group: 'com.google.dagger', name: 'hilt-android-testing', version: hilt_version
kaptAndroidTest group: 'com.google.dagger', name: 'hilt-android-compiler', version: hilt_version

kaptAndroidTest group: 'com.google.dagger', name: 'hilt-compiler', version: hilt_version


androidTestImplementation project(':commons')

testFixturesImplementation project(':commons')
androidTestImplementation testFixtures(project(":client"))
// testImplementation testFixtures(project(":client:testcommons"))

androidTestImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlin_version
androidTestImplementation junitUnitTests
Expand All @@ -217,7 +198,6 @@ dependencies {
androidTestImplementation 'androidx.arch.core:core-runtime:2.1.0'
androidTestImplementation 'androidx.arch.core:core-testing:2.1.0'
androidTestImplementation group: 'androidx.test.espresso', name: 'espresso-idling-resource', version: espresso_core_version
androidTestImplementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
androidTestImplementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

// Test rules and transitive dependencies:
Expand All @@ -240,8 +220,14 @@ dependencies {
testImplementation junitUnitTests
testImplementation group: 'com.google.dagger', name: 'hilt-android', version: hilt_version
testImplementation group: 'com.google.dagger', name: 'hilt-android-testing', version: hilt_version
testImplementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
testImplementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

testFixturesImplementation group: 'com.google.dagger', name: 'hilt-android', version: hilt_version
testFixturesImplementation group: 'com.google.dagger', name: 'hilt-android-testing', version: hilt_version
testFixturesImplementation group: 'androidx.core', name: 'core-ktx', version: androidx_core_ktx_version
testFixturesImplementation group: 'androidx.media3', name: 'media3-session', version: media3_version
testFixturesImplementation group: "org.mockito.kotlin", name: "mockito-kotlin", version: mockito_kotlin_version
testFixturesImplementation group: "androidx.datastore", name: "datastore-preferences", version: datastore_preferences_version
}

kapt {
Expand Down
Loading

0 comments on commit c8030cd

Please sign in to comment.