Skip to content

Commit

Permalink
Merge pull request #18 from kinescope/fix/aar-dependencies
Browse files Browse the repository at this point in the history
AAR dependencies fix
  • Loading branch information
pavel-vorobyev authored Apr 15, 2024
2 parents 7389e97 + 03e20b8 commit 5000c79
Show file tree
Hide file tree
Showing 268 changed files with 2,102 additions and 211 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

def media3_version = "1.1.1"
implementation "androidx.media3:media3-common:$media3_version"
implementation "androidx.media3:media3-common:1.1.1"
implementation "com.google.guava:guava:31.1-android"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import android.os.Bundle
import android.view.View
import android.view.WindowManager
import androidx.core.view.isVisible
import androidx.media3.common.util.UnstableApi
import io.kinescope.sdk.player.KinescopeVideoPlayer
import io.kinescope.sdk.view.KinescopePlayerView

@UnstableApi
class SubtitlesActivity : AppCompatActivity() {
private var isVideoFullscreen = false

Expand All @@ -21,9 +23,9 @@ class SubtitlesActivity : AppCompatActivity() {
kinescopePlayer = KinescopeVideoPlayer(this)
}

lateinit var playerView:KinescopePlayerView
lateinit var fullscreenPlayerView:KinescopePlayerView
lateinit var kinescopePlayer :KinescopeVideoPlayer
private lateinit var playerView: KinescopePlayerView
private lateinit var fullscreenPlayerView: KinescopePlayerView
private lateinit var kinescopePlayer: KinescopeVideoPlayer


override fun onStart() {
Expand All @@ -34,11 +36,11 @@ class SubtitlesActivity : AppCompatActivity() {
playerView.setIsFullscreen(false)
fullscreenPlayerView.setIsFullscreen(true)
playerView.setPlayer(kinescopePlayer)
playerView.onFullscreenButtonCallback = {toggleFullscreen()}
fullscreenPlayerView.onFullscreenButtonCallback = {toggleFullscreen()}
playerView.onFullscreenButtonCallback = { toggleFullscreen() }
fullscreenPlayerView.onFullscreenButtonCallback = { toggleFullscreen() }

kinescopePlayer.loadVideo("eNWM8F6wbVTVa8fBeR66y6", onSuccess = {
if(it != null) {
if (it != null) {
kinescopePlayer.play()
}
})
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.disableResourceValidation=true
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ install:
- FILE="-Dfile=kotlin-kinescope-player-release.aar"
- GROUP_ID="-DgroupId=com.github.kinescope"
- ARTIFACT_ID="-DartifactId=kotlin-kinescope-player"
- VERSION="-Dversion=0.0.1"
- VERSION="-Dversion=0.0.2"
- mvn install:install-file $FILE $GROUP_ID $ARTIFACT_ID $VERSION -Dpackaging=aar -DgeneratePom=true
Binary file modified kotlin-kinescope-player-release.aar
Binary file not shown.
53 changes: 31 additions & 22 deletions kotlin-kinescope-player/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
buildscript {
dependencies {
classpath 'com.github.kezong:fat-aar:1.3.8'
}
}

plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
Expand All @@ -6,6 +12,8 @@ plugins {
id "com.google.protobuf" version "0.8.17"
}

apply plugin: 'com.kezong.fat-aar'

android {
compileSdk 33

Expand All @@ -16,18 +24,18 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"

versionName "0.0.1"
versionName "0.0.2"
}

buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
shrinkResources false
buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"")
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
shrinkResources false
buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"")
}
}
Expand Down Expand Up @@ -63,26 +71,27 @@ configurations.all {
}

dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation 'com.squareup.okio:okio:2.10.0'
implementation 'com.squareup.moshi:moshi:1.14.0'
implementation 'com.squareup.moshi:moshi-adapters:1.14.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.14.0'
implementation 'me.saket.cascade:cascade:1.3.0'
implementation 'com.squareup.retrofit2:converter-protobuf:2.9.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "com.google.android.material:material:1.9.0"
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.14.0"

def media3Version = "1.1.1"
implementation "androidx.media3:media3-exoplayer:$media3Version"
implementation "androidx.media3:media3-exoplayer-dash:$media3Version"
implementation "androidx.media3:media3-exoplayer-hls:$media3Version"
implementation "androidx.media3:media3-ui:$media3Version"
embed "androidx.media3:media3-common:$media3Version"
embed "androidx.media3:media3-exoplayer:$media3Version"
embed "androidx.media3:media3-exoplayer-dash:$media3Version"
embed "androidx.media3:media3-exoplayer-hls:$media3Version"
embed "androidx.media3:media3-ui:$media3Version"
embed "androidx.media3:media3-decoder:$media3Version"
embed "androidx.media3:media3-extractor:$media3Version"
embed "androidx.media3:media3-datasource:$media3Version"
embed "androidx.media3:media3-container:$media3Version"
embed "androidx.media3:media3-database:$media3Version"
embed "androidx.media3:media3-session:$media3Version"

implementation 'com.squareup.picasso:picasso:2.8'
implementation "androidx.datastore:datastore-core:1.0.0"
implementation "com.github.bumptech.glide:glide:4.16.0"
implementation "com.squareup.retrofit2:retrofit:2.11.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added kotlin-kinescope-player/libs/moshi-1.14.0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import android.media.AudioManager
import android.os.Looper
import android.util.AttributeSet
import android.view.GestureDetector
import android.view.Gravity
import android.view.Menu
import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
Expand All @@ -21,7 +19,6 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.view.GestureDetectorCompat
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import androidx.media3.common.C
import androidx.media3.common.PlaybackException
import androidx.media3.common.Player
Expand All @@ -36,24 +33,20 @@ import androidx.media3.ui.CaptionStyleCompat
import androidx.media3.ui.PlayerControlView
import androidx.media3.ui.PlayerView
import androidx.media3.ui.TimeBar
import com.squareup.picasso.Picasso
import com.bumptech.glide.Glide
import io.kinescope.sdk.R
import io.kinescope.sdk.analytics.KinescopeAnalyticsManager
import io.kinescope.sdk.extensions.currentVolumeInPercent
import io.kinescope.sdk.extensions.getAnalyticsArguments
import io.kinescope.sdk.logger.KinescopeLogger
import io.kinescope.sdk.logger.KinescopeLoggerLevel
import io.kinescope.sdk.models.videos.KinescopeVideo
import io.kinescope.sdk.player.KinescopeVideoPlayer
import io.kinescope.sdk.extensions.getAnalyticsArguments
import io.kinescope.sdk.player.quality.KinescopeQualityManager
import io.kinescope.sdk.player.quality.KinescopeQualityVariant
import io.kinescope.sdk.player.quality.getQualityVariantsList
import io.kinescope.sdk.player.speed.KinescopeSpeedVariant
import io.kinescope.sdk.utils.animateRotation
import io.kinescope.sdk.utils.dip
import io.kinescope.sdk.utils.formatLiveStartDate
import me.saket.cascade.CascadePopupMenu
import me.saket.cascade.allChildren


@UnstableApi
Expand Down Expand Up @@ -338,7 +331,7 @@ class KinescopePlayerView(
} else if (fullscreenButton === view) {
onFullscreenButtonCallback?.invoke()
} else if (optionsButton === view) {
displaySettingsWindow()

} else if (subtitlesButton === view) {
//TODO: Subtitles menu
} else if (attachmentsButton === view) {
Expand Down Expand Up @@ -442,10 +435,10 @@ class KinescopePlayerView(
with(posterView) {
isVisible = true
posterUrl?.let {
Picasso.get()
Glide.with(context)
.load(posterUrl)
.placeholder(ContextCompat.getDrawable(context, R.drawable.default_poster)!!)
.into(this)
.placeholder(R.drawable.default_poster)
.into(this as ImageView)
}
}
}
Expand Down Expand Up @@ -473,71 +466,6 @@ class KinescopePlayerView(
updateFullscreenButton()
}

private fun displaySettingsWindow() {
val popup = CascadePopupMenu(
fixedWidth = context.dip(250),
context = context,
anchor = optionsButton!!,
gravity = Gravity.TOP,
styler = CascadePopupMenu.Styler(
background = {
AppCompatResources.getDrawable(
context,
R.drawable.bg_options_rect
)
},
menuItem = {
it.titleView.setTextColor(Color.WHITE)
it.subMenuArrowView.updatePadding(right = 56)
},
menuTitle = {
it.titleView.setTextColor(Color.WHITE)
it.titleView.compoundDrawablePadding = 48
it.titleView.updatePadding(left = 36)
},
),
)

popup.menu.addSubMenu(context.getString(R.string.settings_quality))
.setIcon(R.drawable.ic_option_quality)
.apply {
qualityManager?.variants.orEmpty().forEach { variant ->
add(Menu.NONE, variant.id, Menu.NONE, variant.name)
}
add(
Menu.NONE,
KinescopeQualityVariant.QUALITY_VARIANT_AUTO_ID,
Menu.NONE,
context.getString(R.string.settings_quality_variant_auto)
)
allChildren.forEach { child ->
child.setOnMenuItemClickListener { item ->
qualityManager?.setVariant(id = item.itemId)
true
}
}
}

popup.menu.addSubMenu(context.getString(R.string.settings_speed))
.setIcon(R.drawable.ic_option_playback_speed)
.apply {
val speedVariants = getSpeedVariants()
speedVariants.forEachIndexed { index, variant ->
add(Menu.NONE, index, Menu.NONE, variant.name)
}
allChildren.forEach { child ->
child.setOnMenuItemClickListener { item ->
kinescopePlayer?.setPlaybackSpeed(speedVariants[item.itemId].speed)
getAnalyticsArguments().let { args ->
analyticsManager.speedChanged(args = args)
}
true
}
}
}
popup.show()
}

private fun updateBuffering() {
if (bufferingView != null) {
val showBufferingSpinner =
Expand Down Expand Up @@ -580,7 +508,7 @@ class KinescopePlayerView(
seekView?.isVisible = options.showSeekBar
subtitlesButton?.isVisible = options.showSubtitlesButton
attachmentsButton?.isVisible = options.showAttachments
optionsButton?.isVisible = options.showOptionsButton
optionsButton?.isVisible = false
}
}

Expand Down
Loading

0 comments on commit 5000c79

Please sign in to comment.