You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I apologize for not having this earlier. I made some assumptions that the migration path is simple but it was brought to my attention that it would be helpful to outline how to upgrade. I've noted the main things below, if something is missing please let me know in the comments below.
The following categories are listed below:
General
React
CDN
Web Components
General
Global Types
Global types are no longer required and can be removed from tsconfig.json:
- "types": ["vidstack/globals"]
User/Controls
The player.user object is now player.controls.
The data attribute on the player element changed from data-user-idle to data-controls.
The userIdle media state is now controlsVisible.
The player.user.pauseIdleTracking(true) method is now player.controls.pause() and player.controls.resume().
React
Dependencies
You can remove the vidstack dependency as it's no longer required:
npm uninstall vidstack
Update to pre-release:
npm install @vidstack/react@next
MediaOutlet
Change the MediaOutlet component to MediaProvider:
- import { MediaOutlet } from '@vidstack/react';- <MediaOutlet />+ - import { MediaProvider } from '@vidstack/react';+ <MediaProvider />
Components are no longer prefixed with Media except MediaPlayer and MediaProvider.
Most components still return a DOM element ref. A few like the player return a component instance which you can call methods on.
Some components have been made part of other root components using the builder API. For example, <SliderValue> is now available as Slider.Value, VolumeSlider.Value, and TimeSlider.Value. See the Component API references for more examples.
Default UI
Everything is headless by default now meaning no UI is displayed out of the box. The new examples repo can guide you on how to style your custom player UI.
You can remove the defaultAppearance property.
LiveIndicator
The MediaLiveIndicator component is now LiveButton:
- import { MediaLiveIndicator } from "@vidstack/react";- <MediaLiveIndicator />+ import { LiveButton } from "@vidstack/react";+ <LiveButton />
The data-live-edge attribute was changed to data-edge.
Active Buttons
The active state data attribute of the FullscreenButton (prev data-fullscreen), CaptionButton (prev data-pressed), and PIPButton (prev data-pip) is now data-active.
The part="chapter-title" was changed to data-part="chapter-title".
Menus
Menu components now use the builder API. See Menu API reference as an example.
<MediaMenu position="top center"> is now <Menu.Items placement="top center">.
Portals are now separate via Menu.Portal.
Pre-built menus such as <MediaAudioMenuItems>, <MediaCaptionMenuItems>, <MediaQualityMenuItems>, and <MediaPlaybackRateMenuItems> were all removed in favour of hooks. The new hooks are useAudioOptions, useCaptionOptions, useVideoQualityOptions, and usePlaybackRateOptions. They'll all be documented very soon but you can see the examples repo on how to use caption options. The rest are very similar.
Tailwind
Update plugin in tailwind.config from require('vidstack/tailwind.cjs') to require('@vidstack/react/tailwind.cjs').
Remove "tailwindCSS.experimental.classRegex": ["[cC]lass=['\"](.*)['|\"]"] from your VSCode settings as it's no longer required.
All variants are prefixed with media-* now such as media-paused, media-playing, not-media-paused, not-media-playing, etc. You can configure the plugin and remove it.
Everything is headless by default now meaning no UI is displayed out of the box. The new examples repo can guide you on how to style your custom player UI.
You can remove the default-appearance attribute.
LiveIndicator
The media-live-indicator component is now media-live-button:
- <media-live-indicator>+ <media-live-button>
The data-live-edge attribute was changed to data-edge.
Active Buttons
The active state data attribute of the FullscreenButton (prev data-fullscreen), CaptionButton (prev data-pressed), and PIPButton (prev data-pip) is now data-active.
Remove "tailwindCSS.experimental.classRegex": ["[cC]lass=['\"](.*)['|\"]"] from your VSCode settings as it's no longer required.
All variants are prefixed with media-* now such as media-paused, media-playing, not-media-paused, not-media-playing, etc. You can configure the plugin and remove it.
Set webComponents: true option in the Vidstack Tailwind plugin config to optimize selectors:
require('vidstack/tailwind.cjs')({// Change the media variants prefix.prefix: 'media',// Enables more efficient selectors.webComponents: true,});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
👋
I apologize for not having this earlier. I made some assumptions that the migration path is simple but it was brought to my attention that it would be helpful to outline how to upgrade. I've noted the main things below, if something is missing please let me know in the comments below.
The following categories are listed below:
General
Global Types
Global types are no longer required and can be removed from
tsconfig.json
:- "types": ["vidstack/globals"]
User/Controls
player.user
object is nowplayer.controls
.data-user-idle
todata-controls
.userIdle
media state is nowcontrolsVisible
.player.user.pauseIdleTracking(true)
method is nowplayer.controls.pause()
andplayer.controls.resume()
.React
Dependencies
vidstack
dependency as it's no longer required:MediaOutlet
Change the
MediaOutlet
component toMediaProvider
:Styles
Community Skin
The
MediaCommunitySkin
is now theDefaultAudioLayout
andDefaultVideoLayout
:Remember to update the styles too (see above).
Thumbnails
The
thumbnails
property has been removed from player component and moved to the new layouts:Components
Media
exceptMediaPlayer
andMediaProvider
.<SliderValue>
is now available asSlider.Value
,VolumeSlider.Value
, andTimeSlider.Value
. See the Component API references for more examples.Default UI
defaultAppearance
property.LiveIndicator
MediaLiveIndicator
component is nowLiveButton
:data-live-edge
attribute was changed todata-edge
.Active Buttons
The active state data attribute of the
FullscreenButton
(prevdata-fullscreen
),CaptionButton
(prevdata-pressed
), andPIPButton
(prevdata-pip
) is nowdata-active
.Tooltips
OLD
NEW
The new examples repo can guide you on how to properly setup tooltips.
Sliders
<SliderValue>
is now<Slider.Value>
,<VolumeSlider.Value>
, and<TimeSlider.Value>
.<SliderThumbnail>
is now<TimeSlider.Thumbnail>
.<SliderVideo>
is now<TimeSlider.Video>
.data-interactive
attribute was changed todata-active
.slot="preview"
was changed to<Slider.Preview>
,<VolumeSlider.Preview>
, and<TimeSlider.Preview>
.<TimeSlider.Chapters>
.part="chapter-title"
was changed todata-part="chapter-title"
.Menus
<MediaMenu position="top center">
is now<Menu.Items placement="top center">
.Menu.Portal
.<MediaAudioMenuItems>
,<MediaCaptionMenuItems>
,<MediaQualityMenuItems>
, and<MediaPlaybackRateMenuItems>
were all removed in favour of hooks. The new hooks areuseAudioOptions
,useCaptionOptions
,useVideoQualityOptions
, andusePlaybackRateOptions
. They'll all be documented very soon but you can see the examples repo on how to use caption options. The rest are very similar.Tailwind
tailwind.config
fromrequire('vidstack/tailwind.cjs')
torequire('@vidstack/react/tailwind.cjs')
."tailwindCSS.experimental.classRegex": ["[cC]lass=['\"](.*)['|\"]"]
from your VSCode settings as it's no longer required.media-*
now such asmedia-paused
,media-playing
,not-media-paused
,not-media-playing
, etc. You can configure the plugin and remove it.CDN
Styles
Scripts
Without layouts (prev headless option):
With layouts (prev Community Skin option):
👉 From here continue reading the Web Components section below for additional changes.
Web Components
Dependencies
Media Outlet
Change the
media-outlet
component tomedia-provider
:Styles
Community Skin
The
media-community-skin
element is split into nowmedia-audio-layout
andmedia-video-layout
:Remember to update the styles too (see above).
Thumbnails
The
thumbnails
property has been removed from player component and moved to the new layouts:Default UI
default-appearance
attribute.LiveIndicator
media-live-indicator
component is nowmedia-live-button
:data-live-edge
attribute was changed todata-edge
.Active Buttons
The active state data attribute of the
FullscreenButton
(prevdata-fullscreen
),CaptionButton
(prevdata-pressed
), andPIPButton
(prevdata-pip
) is nowdata-active
.Tooltips
OLD
NEW
The new examples repo can guide you on how to properly setup tooltips.
Sliders
data-interactive
attribute was changed todata-active
.slot="preview"
was changed to<media-slider-preview>
.<media-slider-chapters>
.part="chapter-title"
was changed todata-part="chapter-title"
.Menus
<media-menu position="top center">
is now<media-menu-items placement="top center">
.<media-menu-porta>
.<media-audio-menu-items>
is now<media-audio-radio-group>
and uses templates.<media-caption-menu-items>
is nowmedia-captions-radio-group
and uses templates.<media-quality-menu-items>
is nowmedia-quality-radio-group
and uses templates.<media-playback-rate-menu-items>
is nowmedia-speed-radio-group
and uses templates.Tailwind
"tailwindCSS.experimental.classRegex": ["[cC]lass=['\"](.*)['|\"]"]
from your VSCode settings as it's no longer required.media-*
now such asmedia-paused
,media-playing
,not-media-paused
,not-media-playing
, etc. You can configure the plugin and remove it.webComponents: true
option in the Vidstack Tailwind plugin config to optimize selectors:Beta Was this translation helpful? Give feedback.
All reactions