-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor useMediaInTimeline
to remove mediaRef
dependency and expose via Internals
#5714
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
Refactor useMediaInTimeline
to remove mediaRef
dependency and expose via Internals
#5714
Conversation
Co-authored-by: samohovets <[email protected]>
Co-authored-by: samohovets <[email protected]>
useMediaInTimeline
or equivalent to show new media tags in the Remotion Studio timelineuseMediaInTimeline
to remove mediaRef
dependency and expose publicly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Do not expose it publicly. It should be exposed through "Internals.
-
No need for public doc.
@copilot useMediaInTimeline is supposed to be the private API, no need for docs and public API. Expose it through Internals from "remotion" |
Co-authored-by: samohovets <[email protected]>
Fixed in commit 2d64414.
Done in commit 2d64414. |
useMediaInTimeline
to remove mediaRef
dependency and expose publiclyuseMediaInTimeline
to remove mediaRef
dependency and expose via Internals
…copilot/fix-30f997e6-8b98-4121-bfc6-d3d1b9425d6c
…8-4121-bfc6-d3d1b9425d6c
…copilot/fix-30f997e6-8b98-4121-bfc6-d3d1b9425d6c
…copilot/fix-30f997e6-8b98-4121-bfc6-d3d1b9425d6c
Overview
This PR refactors
useMediaInTimeline
to remove themediaRef
parameter, making it a cleaner, more reusable API that can now be used by@remotion/media
components and custom media wrappers.Problem
The original
useMediaInTimeline
hook required amediaRef
parameter, which was poor API design because:@remotion/media
components that don't directly manage HTML media elementsSolution
1. Created
useMediaTag
hookExtracted the media playback control functionality into a separate internal hook (
packages/core/src/use-media-tag.ts
). This hook:mediaRef
Internals
for use byAudioForPreview
andVideoForPreview
2. Refactored
useMediaInTimeline
The hook now:
mediaRef
parameter (no longer needed!)onAutoPlayError
,isPremounting
,isPostmounting
parameters (moved touseMediaTag
)Internals
fromremotion
package for internal use3. Updated existing components
Both
AudioForPreview
andVideoForPreview
now use both hooks:Usage Example
Internal code and
@remotion/media
components can useuseMediaInTimeline
viaInternals
to show custom media in the timeline without needing a media element reference:Benefits
@remotion/media
and internal componentsInternals
for internal use and@remotion/media
packageTesting
@remotion/media
package buildsCloses #5704
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.