Skip to content

Commit

Permalink
Merge branch 'main' into releases/v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daytime-em authored Jun 13, 2024
2 parents 2d0cf6c + f82074b commit e6c9524
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 26 deletions.
9 changes: 4 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.14'
kotlinCompilerExtensionVersion '1.5.14
}
packagingOptions {
resources {
Expand All @@ -52,28 +52,27 @@ dependencies {
implementation project(':library')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.activity:activity-ktx:1.8.2'
implementation "androidx.fragment:fragment-ktx:1.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'net.danlew:android.joda:2.12.7'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation 'androidx.activity:activity-compose:1.8.0'
implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_ui_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$compose_ui_version"
implementation "androidx.compose.material:material-icons-extended:$compose_ui_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:0.34.0"
implementation 'androidx.compose.material:material:1.6.2'
implementation 'androidx.compose.material:material:1.6.1'
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.4.1' apply false
id 'com.android.library' version '8.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'com.mux.gradle.android.mux-android-distribution' version '1.1.2' apply false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 19 16:04:49 PST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ muxDistribution {
dependencies {
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation "io.github.crow-misia.libyuv:libyuv-android:0.31.1"
implementation "io.github.crow-misia.libyuv:libyuv-android:0.29.0"

implementation 'androidx.core:core-ktx:1.12.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
Expand Down
15 changes: 11 additions & 4 deletions library/src/main/java/com/mux/video/upload/api/MuxUpload.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import java.io.File
class MuxUpload private constructor(
private var uploadInfo: UploadInfo,
private val autoManage: Boolean = true,
initialStatus: UploadStatus = UploadStatus.Ready
) {

/**
Expand All @@ -59,7 +60,7 @@ class MuxUpload private constructor(
* To be notified of status updates (including upload progress), use [setStatusListener]
*/
@Suppress("MemberVisibilityCanBePrivate")
val uploadStatus: UploadStatus get() = uploadInfo.statusFlow?.value ?: currentStatus
val uploadStatus: UploadStatus

/**
* True when the upload is running, false if it's paused, failed, or canceled
Expand Down Expand Up @@ -306,6 +307,10 @@ class MuxUpload private constructor(
observerJob = newObserveProgressJob(uploadInfo)
}

init {
uploadStatus = initialStatus
}

/**
* The current progress of an upload, in terms of time elapsed and data transmitted
*/
Expand Down Expand Up @@ -340,7 +345,7 @@ class MuxUpload private constructor(
* @param videoFile a File that represents the video file you want to upload
*/
@Suppress("MemberVisibilityCanBePrivate")
class Builder(val uploadUri: Uri, val videoFile: File) {
class Builder constructor(val uploadUri: Uri, val videoFile: File) {

/**
* Create a new Builder with the specified input file and upload URL
Expand All @@ -349,7 +354,8 @@ class MuxUpload private constructor(
* @param videoFile a File that represents the video file you want to upload
*/
@Suppress("unused")
constructor(uploadUri: String, videoFile: File): this(Uri.parse(uploadUri), videoFile)
constructor(uploadUri: String, videoFile: File)
: this(Uri.parse(uploadUri), videoFile)

private var manageTask: Boolean = true
private var uploadInfo: UploadInfo = UploadInfo(
Expand Down Expand Up @@ -440,6 +446,7 @@ class MuxUpload private constructor(
* [MuxUploadManager]
*/
@JvmSynthetic
internal fun create(uploadInfo: UploadInfo) = MuxUpload(uploadInfo = uploadInfo)
internal fun create(uploadInfo: UploadInfo, initialStatus: UploadStatus = UploadStatus.Ready)
= MuxUpload(uploadInfo = uploadInfo, initialStatus = initialStatus)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package com.mux.video.upload.api
*
* Kotlin callers can use the [Result] API as normal
*/
@Suppress("unused")
class UploadResult {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ sealed class UploadStatus {
/**
* This upload hos not been started. It is ready to start by calling [MuxUpload.start]
*/
data object Ready: UploadStatus()
object Ready: UploadStatus()

/**
* This upload has been started via [MuxUpload.start] but has not yet started processing anything
*/
data object Started: UploadStatus()
object Started: UploadStatus()

/**
* This upload is being prepared. If standardization is required, it is done during this step
*
* @see MuxUpload.Builder.standardizationRequested
*/
data object Preparing: UploadStatus()
object Preparing: UploadStatus()

/**
* The upload is currently being sent to Mux Video. The progress is available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ internal class UploadMetrics private constructor() {

private val logger get() = MuxUploadSdk.logger


private fun formatMilliseconds(ms:Long):String {
return String.format("%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(ms),
TimeUnit.MILLISECONDS.toMinutes(ms) -
TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(ms)), // The change is in this line
TimeUnit.MILLISECONDS.toSeconds(ms) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(ms)));
}

private suspend fun getEventInfo(startTimeMillis: Long,
startTimeKey: String,
endTimeMillis: Long,
Expand Down Expand Up @@ -115,8 +125,8 @@ internal class UploadMetrics private constructor() {
maximumResolution:String,
sessionId: String,
uploadInfo: UploadInfo
) = runCatching {
val body = JSONObject()
) {
var body = JSONObject()
body.put("type", "upload_input_standardization_succeeded")
body.put("session_id", sessionId)
body.put("version", "1")
Expand All @@ -139,8 +149,8 @@ internal class UploadMetrics private constructor() {
maximumResolution:String,
sessionId: String,
uploadInfo: UploadInfo
) = runCatching {
val body = JSONObject()
) {
var body = JSONObject()
body.put("type", "upload_input_standardization_failed")
body.put("session_id", sessionId)
body.put("version", "1")
Expand All @@ -162,8 +172,8 @@ internal class UploadMetrics private constructor() {
inputFileDurationMs: Long,
sessionId: String,
uploadInfo: UploadInfo
) = runCatching {
val body = JSONObject()
) {
var body = JSONObject()
body.put("type", "upload_succeeded")
body.put("session_id", sessionId)
body.put("version", "1")
Expand All @@ -183,8 +193,8 @@ internal class UploadMetrics private constructor() {
errorDescription:String,
sessionId: String,
uploadInfo: UploadInfo
) = runCatching {
val body = JSONObject()
) {
var body = JSONObject()
body.put("type", "uploadfailed")
body.put("session_id", sessionId)
body.put("version", "1")
Expand Down

0 comments on commit e6c9524

Please sign in to comment.