mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(site): update use-media reference for mediahost architecture (#1702)
Co-authored-by: Darius Cepulis <dcepulis@mux.com>
This commit is contained in:
co-authored by
Darius Cepulis
parent
964d9ca1d7
commit
9bcdf5ffc2
@@ -0,0 +1,36 @@
|
||||
.media-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.media-container video {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 12px;
|
||||
margin: 0;
|
||||
font-size: 0.8125rem;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.info-panel div {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.info-panel dt {
|
||||
min-width: 80px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.info-panel dd {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { createPlayer, isMediaSourceCapable, isMediaVideoDimensionsCapable } from '@videojs/react';
|
||||
import { Video, videoFeatures } from '@videojs/react/video';
|
||||
|
||||
const Player = createPlayer({
|
||||
features: videoFeatures,
|
||||
});
|
||||
|
||||
function MediaInfo() {
|
||||
const media = Player.useMedia();
|
||||
|
||||
if (!media) return null;
|
||||
|
||||
return (
|
||||
<dl className="info-panel">
|
||||
{isMediaSourceCapable(media) && (
|
||||
<div>
|
||||
<dt>src</dt>
|
||||
<dd>{media.currentSrc || '—'}</dd>
|
||||
</div>
|
||||
)}
|
||||
{isMediaVideoDimensionsCapable(media) && (
|
||||
<>
|
||||
<div>
|
||||
<dt>videoWidth</dt>
|
||||
<dd>{media.videoWidth}px</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>videoHeight</dt>
|
||||
<dd>{media.videoHeight}px</dd>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
|
||||
export default function BasicUsage() {
|
||||
return (
|
||||
<Player.Provider>
|
||||
<Player.Container className="media-container">
|
||||
<Video
|
||||
src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4"
|
||||
autoPlay
|
||||
muted
|
||||
playsInline
|
||||
loop
|
||||
/>
|
||||
<MediaInfo />
|
||||
</Player.Container>
|
||||
</Player.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user