Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DE-7266: Remove patchIgnoreStateEnded #48

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/src/InterstitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ export const InterstitialPage = () => {
type: clpp.Type.HLS,
},
}}
// Possibly it's something wrong with the AIP stream http://localhost:3000/vod-preroll.m3u8
// but unfortunately what happens is that we get state "Ended" and then the video
// continues playing for another cca 800ms. This would obviously cause a glitch
// in the UI so configure the player to ignore all ended states changes
patchIgnoreStateEnded={true}
hasTopControlsBar={false}
interstitialOptions={{
// Start resolving X-ASSET-LIST 15 seconds or less before
Expand Down
18 changes: 1 addition & 17 deletions src/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,6 @@ export class Player {
* The last playback state
*/
private _lastPlaybackState: State = State.Unset
/**
* If true state changes to "ended" state should be ignored
*/
private _ignoreStateEnded = false
/**
* Timeline cues
*/
Expand Down Expand Up @@ -417,7 +413,7 @@ export class Player {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const previousState = toState(e.detail.previousState)

if (this._ignoreStateEnded && currentState === State.Ended) {
if (currentState === State.Ended) {
return
}

Expand Down Expand Up @@ -544,18 +540,6 @@ export class Player {
return this.pp_?.getTrackManager() ?? null
}

/**
* Configure the player to ignore the "ended" state change. This is useful
* for situations where RESTOplay goes to the "ended" state prematurely, which
* sometimes happens (e.g. state changes to ended, but the video still plays
* another 800 ms or so and timeupdates are triggered).
* Not sure if this is a bug in PRESTOplay or a problem with the asset, but
* it happens.
*/
set ignoreStateEnded(value: boolean) {
this._ignoreStateEnded = value
}

/**
* Seek to the given position. Calling this function has no effect unless the
* presto instance is already initialized.
Expand Down
10 changes: 0 additions & 10 deletions src/interstitial/InterstitialPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ export type InterstitialPlayerProps = {
* Custom style for the player container.
*/
style?: React.CSSProperties
/**
* If true, the player will ignore all state changes to state "ended".
*/
patchIgnoreStateEnded?: boolean
/**
* Render a custom top companion component.
*/
Expand All @@ -125,12 +121,6 @@ export type InterstitialPlayerProps = {
export const InterstitialPlayer = React.memo((props: InterstitialPlayerProps) => {
const playerRef = useRef(new PlayerHlsi(props.onHlsiPlayerReady))

useEffect(() => {
if (props.patchIgnoreStateEnded) {
playerRef.current.ignoreStateEnded = true
}
}, [props.patchIgnoreStateEnded])

const load = async () => {
try {
await playerRef.current.loadHlsi(props.asset)
Expand Down
Loading