Skip to content

Video-on-demand App using MVVM, Kotlin, Coroutine, Retrofit 2, RoomDB, Hilt, JUnit4, Espresso

License

Notifications You must be signed in to change notification settings

ryanw-mobile/video-player-app

Repository files navigation

Video Player App
Gradle Build Codacy Coverage Badge Codacy Quality Badge Renovate enabled

Warning

I do not support the use of my code for your job applications, as it creates unfair competition. If you copy or fork this for your own interviews, you risk disqualification. Please respect the integrity of the process and create your own work.

A responsive Android sample app written in Kotlin and Jetpack Compose, supporting different navigation layout on screen sizes. The Media 3 Exoplayer is implemented on top of the single activity architecture. It is fully functional with Picture-in-Picture support.

The events under the Events tab provides video playback. The schedule under the Schedule tab refreshes automatically every 30 seconds. For both tabs, you can always do swipe-to-refresh, or tap the navigation icon to scroll to the top of the list.

Download the App

If you want to try out the app without building it, check out the Releases section where you can find the APK and App Bundles for each major release.

 

History

This was a code test assignment done in October, 2021, but I am still keep on improving the codes for demonstration purpose.. The task covered common RESTApi, SQLite, RecyclerView, Constraint Layout, MVVM, plus dependency injection and testings.

The original XML View version is no longer maintained, you can access to the XML branch here.

Please note that the APIs are supplied by DAZN in 2021. They may not work at any time. There is a plan to replace them with my own APIs and contents.

Screenshots

 

 

To-do lists

Planned enhancements are now logged as issues.

High level architecture

  • Kotlin
  • MVVM & clean architecture
  • Jetpack Compose - Single Activity
  • Kotlin Coroutines and Flow
  • Dependency Injection using Dagger Hilt
  • Material 3
  • Dynamic screen layout support using Windows Size Class
  • Jetpack Media 3 video player
  • Gradle Kotlin DSL and Version Catalog
  • Baseline Profile
  • Full unit test and UI (Journey) test suite

Dependencies

  • AndroidX Core KTX - Apache 2.0 - Extensions to Java APIs for Android development
  • AndroidX Media3 - Apache 2.0 - Media support libraries
  • JUnit - EPL 2.0 - A simple framework to write repeatable tests
  • AndroidX Espresso - Apache 2.0 - UI testing framework
  • Jetpack Compose - Apache 2.0 - Modern toolkit for building native UI
  • AndroidX Benchmark - Apache 2.0 - Benchmarking library
  • AndroidX DataStore - Apache 2.0 - Data storage solution
  • AndroidX Legacy Support - Apache 2.0 - Legacy libraries
  • AndroidX Lifecycle - Apache 2.0 - Lifecycles-aware components
  • AndroidX Room - Apache 2.0 - Persistence library
  • Retrofit - Apache 2.0 - A type-safe HTTP client for Android and Java
  • Moshi - Apache 2.0 - A modern JSON library for Android and Java
  • OkHttp Logging Interceptor - Apache 2.0 - Logging interceptor for OkHttp
  • Timber - Apache 2.0 - A logger with a small, extensible API
  • Coil - Apache 2.0 - An image loading library for Android backed by Kotlin Coroutines
  • MockK - Apache 2.0 - Mocking library for Kotlin
  • Robolectric - MIT - A framework that brings fast, reliable unit tests to Android
  • Kotest - Apache 2.0 - Kotlin test framework
  • Hilt - Apache 2.0 - A dependency injection library for Android that reduces the boilerplate of doing manual dependency injection
  • LeakCanary - Apache 2.0 - A memory leak detection library for Android
  • AndroidX Profile Installer - Apache 2.0 - Install profiles for faster startup

Plugins

Building the App

Setting up the keystore

Release builds will be signed if either the keystore file or environment variables are set. Otherwise, the app will be built unsigned.

Local

  • Android Keystore is not being stored in this repository. You need your own Keystore to generate the apk / App Bundle

  • If your project folder is at /app/video-player-app/, the Keystore file and keystore.properties should be placed at /app/

  • The format of keystore.properties is:

       store=/app/release-key.keystore
       alias=<alias>
       pass=<alias password>
       storePass=<keystore password>
    

CI environment

  • This project has been configured to support automated CI builds.

  • The following environment variables have been set to provide the keystore:

       CI = true
       HOME = <the home directory of the bitrise environment>
       CI_ANDROID_KEYSTORE_PASSWORD = <your keystore password>
       CI_ANDROID_KEYSTORE_ALIAS = <your keystore alias>
       CI_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD = <your keystore private key password>
    

Build and install on the connected device

This app has two build variants: Debug and Release. The most common build commands are:

  • ./gradlew clean installDebug
  • ./gradlew clean instal
  • ./gradlew clean bundleRelease
  • ./gradlew clean assembleRelease

The generated apk(s) will be stored under app/build/outputs/ Debug builds will have an App package name suffix .debug