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

Fix: requestVideoFrameCallback being called on wrong object #10415

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/rendering/renderers/shared/texture/sources/VideoSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class VideoSource extends TextureSource<VideoResource>
}
else
{
this._videoFrameRequestCallbackHandle = (this.source as any).requestVideoFrameCallback(
this._videoFrameRequestCallbackHandle = this.resource.requestVideoFrameCallback(
this._videoFrameRequestCallback
);
}
Expand Down Expand Up @@ -490,7 +490,7 @@ export class VideoSource extends TextureSource<VideoResource>
if (this._autoUpdate && this._isSourcePlaying())
{
// Determine if we should use the browser's native video frame callback (generally for better performance)
if (!this._updateFPS && (this.source as any).requestVideoFrameCallback)
if (!this._updateFPS && this.resource.requestVideoFrameCallback)
{
// If connected to a custom ticker, remove the update frame function from it
if (this._isConnectedToTicker)
Expand All @@ -504,7 +504,7 @@ export class VideoSource extends TextureSource<VideoResource>
// Check if we haven't already requested a video frame callback, and if not, request one
if (this._videoFrameRequestCallbackHandle === null)
{
this._videoFrameRequestCallbackHandle = (this.source as any).requestVideoFrameCallback(
this._videoFrameRequestCallbackHandle = this.resource.requestVideoFrameCallback(
this._videoFrameRequestCallback
);
}
Expand All @@ -514,7 +514,7 @@ export class VideoSource extends TextureSource<VideoResource>
// If a video frame request callback exists, cancel it, as we are switching to manual ticker-based updates
if (this._videoFrameRequestCallbackHandle !== null)
{
(this.source as any).cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle);
this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle);
this._videoFrameRequestCallbackHandle = null;
}

Expand All @@ -535,7 +535,7 @@ export class VideoSource extends TextureSource<VideoResource>
// Cancel any existing video frame callback request
if (this._videoFrameRequestCallbackHandle !== null)
{
(this.source as any).cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle);
this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle);
this._videoFrameRequestCallbackHandle = null;
}

Expand Down