         guard state != newState else { return }
         state = newState
 
-        switch newState {
+        switch state {
         case .stalling:
             trigger(.stalling)
         case .paused:

    }

    private func handleLoadedTimeRangesEvent() {
        guard let timeRange = player?.currentItem?.loadedTimeRanges.first?.timeRangeValue else {
            return
        }

        let info = [
            "start_position": CMTimeGetSeconds(timeRange.start),
            "end_position": CMTimeGetSeconds(CMTimeAdd(timeRange.start, timeRange.duration)),
            "duration": CMTimeGetSeconds(timeRange.duration),
            ]

        trigger(.didUpdateBuffer, userInfo: info)
    }


    }

    private var dvrWindowStart: Double? {
        guard let end = dvrWindowEnd, isDvrAvailable, playbackType == .live else { return nil }
        return end - duration
    }

    private var dvrWindowEnd: Double? {
        guard isDvrAvailable, playbackType == .live else { return nil }
        return seekableTimeRanges.max { rangeA, rangeB in rangeA.timeRangeValue.end.seconds < rangeB.timeRangeValue.end.seconds }?.timeRangeValue.end.seconds
    }

