Skip to content

Commit

Permalink
DE-7266: Remove patchIgnoreStateEnded (#48)
Browse files Browse the repository at this point in the history
This option was a workaround for a bug
in the SDK (DE-7073). The bug has been
since fixed so the workaround is no longer
needed.
  • Loading branch information
fingerartur authored Sep 9, 2024
1 parent 820f071 commit 5e8b188
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
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={{
config: {
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 @@ -99,10 +99,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 Down Expand Up @@ -134,12 +130,6 @@ export const InterstitialPlayer = React.memo((props: InterstitialPlayerProps) =>
enableFocus(props.enableFocus ?? true)
}, [props.enableFocus])

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

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

0 comments on commit 5e8b188

Please sign in to comment.