Skip to content

Project and library update #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: mainline
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions app/build.gradle

This file was deleted.

78 changes: 78 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ksp)
alias(libs.plugins.kotlin.kapt)
}

android {
namespace = "com.amazonaws.ivs.player.ecommerce"
compileSdk = 35

defaultConfig {
applicationId = "com.amazonaws.ivs.player.ecommerce"
minSdk = 23
targetSdk = 35
versionCode = 1
versionName = "1.0"

buildConfigField("String", "BASE_STREAM_URL", "\"https://4c62a87c1810.us-west-2.playback.live-video.net/api/video/v1/us-west-2.049054135175.channel.onToXRHIurEP.m3u8\"")
buildConfigField("String", "BASE_IMAGE_URL", "\"https://ecommerce.ivsdemos.com/\"")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

buildFeatures {
viewBinding = true
dataBinding = true
buildConfig = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}
}

dependencies {
// Android
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.material)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.exifinterface)

// Kotlin
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.coroutines.core)

// Hilt
implementation(libs.hilt.android)
ksp(libs.hilt.compiler)

// Glide
implementation(libs.glide)
ksp(libs.compiler)

// Okhttp3
implementation(libs.okhttp)

// Timber
implementation(libs.timber)

// Amazon IVS
implementation(libs.ivs.player)
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".App"
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".App"
android:theme="@style/AppTheme">

<activity
android:name=".ui.MainActivity"
android:screenOrientation="portrait"
android:exported="true"
tools:ignore="LockedOrientationActivity">
tools:ignore="DiscouragedApi,LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package com.amazonaws.ivs.player.ecommerce.ui.viewmodels

import android.net.Uri
import android.view.Surface
import android.view.TextureView
import androidx.core.net.toUri
import androidx.lifecycle.ViewModel
import com.amazonaws.ivs.player.MediaPlayer
import com.amazonaws.ivs.player.MediaType
import com.amazonaws.ivs.player.Player
import com.amazonaws.ivs.player.ecommerce.BuildConfig
import com.amazonaws.ivs.player.ecommerce.common.*
import com.amazonaws.ivs.player.ecommerce.models.*
import com.amazonaws.ivs.player.ecommerce.common.METADATA_TIMEOUT
import com.amazonaws.ivs.player.ecommerce.common.asObject
import com.amazonaws.ivs.player.ecommerce.common.onTick
import com.amazonaws.ivs.player.ecommerce.common.setListener
import com.amazonaws.ivs.player.ecommerce.models.ErrorModel
import com.amazonaws.ivs.player.ecommerce.models.MetadataModel
import com.amazonaws.ivs.player.ecommerce.models.ProductModel
import com.amazonaws.ivs.player.ecommerce.models.ProductsModel
import com.amazonaws.ivs.player.ecommerce.models.SizeModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down Expand Up @@ -50,7 +57,7 @@ class MainViewModel @Inject constructor(products: ProductsModel) : ViewModel() {

fun initPlayer(textureView: TextureView) {
_onLoading.update { true }
player = MediaPlayer(textureView.context)
player = MediaPlayer.Builder(textureView.context).build()
player?.setListener(
onVideoSizeChanged = { width, height ->
Timber.d("Video size changed: $width $height")
Expand Down Expand Up @@ -79,7 +86,7 @@ class MainViewModel @Inject constructor(products: ProductsModel) : ViewModel() {
}
)
player?.setSurface(Surface(textureView.surfaceTexture))
player?.load(Uri.parse(BuildConfig.BASE_STREAM_URL))
player?.load(BuildConfig.BASE_STREAM_URL.toUri())
player?.play()
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
<background android:drawable="@mipmap/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<monochrome android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
7 changes: 4 additions & 3 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
<background android:drawable="@mipmap/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<monochrome android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
1 change: 0 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
<color name="yellow">#FFE249</color>
<color name="transparent">#00000000</color>
<color name="translucent">#99000000</color>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
13 changes: 13 additions & 0 deletions app/src/main/res/xml/backup_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>
16 changes: 16 additions & 0 deletions app/src/main/res/xml/data_extraction_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>
24 changes: 0 additions & 24 deletions build.gradle

This file was deleted.

8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// 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.jetbrains.kotlin.android) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.kotlin.kapt) apply false
}
45 changes: 45 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[versions]
agp = "8.9.1"
appcompat = "1.7.0"
compiler = "4.16.0"
constraintlayout = "2.2.1"
exifinterface = "1.4.0"
fragmentKtx = "1.8.6"
glide = "4.16.0"
hiltAndroid = "2.56.1"
ivsPlayer = "1.38.0"
kotlin = "2.1.10"
kotlinx-serialization-json = "1.8.0"
kotlinxCoroutinesAndroid = "1.10.1"
kotlinxCoroutinesCore = "1.10.1"
ksp = "2.1.10-1.0.31"
lifecycleRuntimeKtx = "2.8.7"
material = "1.12.0"
okhttp = "5.0.0-alpha.14"
timber = "5.0.1"

[libraries]
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version.ref = "exifinterface" }
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
compiler = { module = "com.github.bumptech.glide:ksp", version.ref = "compiler" }
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroid" }
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hiltAndroid" }
ivs-player = { module = "com.amazonaws:ivs-player", version.ref = "ivsPlayer" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" }
material = { module = "com.google.android.material:material", version.ref = "material" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hiltAndroid" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Sep 05 15:42:18 EEST 2023
#Mon Mar 17 15:40:26 EET 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading