Skip to content

Commit

Permalink
yet more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daytime-em committed Aug 7, 2024
1 parent 6000e05 commit e982098
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions library/src/main/java/com/mux/stats/sdk/muxstats/PlayerUtils.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.mux.stats.sdk.muxstats

import android.net.Uri
import android.util.Log
import androidx.annotation.OptIn
import androidx.media3.common.Format
import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
import androidx.media3.common.Player
import androidx.media3.common.Timeline
import androidx.media3.common.Tracks
import androidx.media3.common.util.UnstableApi
import com.mux.android.util.oneOf
import com.mux.stats.sdk.core.model.VideoData
import com.mux.stats.sdk.core.util.MuxLogger
Expand All @@ -18,6 +19,7 @@ private const val LOG_TAG = "PlayerUtils"
/**
* Returns true if any media track in the given [Tracks] object had a video MIME type
*/
@OptIn(UnstableApi::class)
fun Tracks.hasAtLeastOneVideoTrack(): Boolean {
return groups.map { it.mediaTrackGroup }
.filter { trackGroup -> trackGroup.length > 0 }
Expand Down Expand Up @@ -91,13 +93,12 @@ fun MuxStateCollector.handlePlayWhenReady(
playWhenReady: Boolean,
@Player.State playbackState: Int
) {
Log.w("PlayerUtils", "handlePlayWhenReady: Called. pwr is $playWhenReady")
Log.w("PlayerUtils", "handlePlayWhenReady: Called. state is $playbackState")
MuxLogger.d("PlayerUtils", "handlePlayWhenReady: Called. pwr is $playWhenReady")
if (playWhenReady) {
Log.i("PlayerUtils", "handlePlayWhenReady: dispatching play")
MuxLogger.d("PlayerUtils", "handlePlayWhenReady: dispatching play")
play()
if (playbackState == Player.STATE_READY) {
Log.i("PlayerUtils", "handlePlayWhenReady: dispatching playing")
MuxLogger.d("PlayerUtils", "handlePlayWhenReady: dispatching playing")
// If we were already READY when playWhenReady is set, then we are definitely also playing
playing()
}
Expand Down

0 comments on commit e982098

Please sign in to comment.