Skip to content

Commit

Permalink
Releases/v1.3.1
Browse files Browse the repository at this point in the history
## Improvements

* fix: enable() should reset the internal state + fix holding onto stale playhead time (#66)



Co-authored-by: Emily Dixon <edixon@mux.com>
Co-authored-by: GitHub <noreply@github.com>
  • Loading branch information
daytime-em and web-flow authored Aug 6, 2024
1 parent dd17c52 commit 19a5664
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ abstract class MuxDataSdk<Player, PlayerView : View> @JvmOverloads protected con
* @param customerData [CustomerData] with metadata about the new view
* @see CustomerData
*/
open fun enable(customerData: CustomerData) = muxStats.enable(customerData)
open fun enable(customerData: CustomerData) {
collector.resetState()
muxStats.enable(customerData)
}

/**
* Dispatch a raw event to the View. Please use this method with caution, as unexpected events can
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ open class MuxStateCollector(
*/
@Suppress("unused")
fun programChange(customerVideoData: CustomerVideoData) {
// keep current play state, since the actual stream should still be playing
reset()
muxStats.programChange(customerVideoData)
}
Expand All @@ -420,9 +421,17 @@ open class MuxStateCollector(
*/
@Suppress("unused")
fun videoChange(customerVideoData: CustomerVideoData) {
resetState()
muxStats.videoChange(customerVideoData)
}

/**
* Returns the Collector to the state where it has processed no events.
*/
@Suppress("MemberVisibilityCanBePrivate")
fun resetState() {
_playerState = MuxPlayerState.INIT
reset()
muxStats.videoChange(customerVideoData)
}

/**
Expand Down Expand Up @@ -526,6 +535,7 @@ open class MuxStateCollector(
seekedEventsSent = 0
firstFrameReceived = false
firstFrameRenderedAtMillis = FIRST_FRAME_NOT_RENDERED
playbackPositionMills = TIME_UNKNOWN
allowedHeaders.clear()
}

Expand Down

0 comments on commit 19a5664

Please sign in to comment.