Skip to content

Commit

Permalink
feat: 透传 video 标签 crossorigin
Browse files Browse the repository at this point in the history
  • Loading branch information
xiabaoying authored and ambar committed Mar 18, 2024
1 parent fc20672 commit 68c65bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/src/MP4Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const App = () => {
key={query.key}
autoplay={query.autoplay !== '0'}
sources={'hls' in query ? hlsSources : sources}
crossOrigin="anonymous"
localeConfig={{
'zh-Hans': {
'quality-ld': {
Expand Down
3 changes: 3 additions & 0 deletions packages/griffith/src/components/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type InnerPlayerProps = {
hideCover?: boolean
noWriteDocTitle?: boolean
layerContent?: React.ReactNode
crossOrigin?: string | undefined
}

// 仅供 Provider 使用的属性
Expand Down Expand Up @@ -143,6 +144,7 @@ const InnerPlayer: React.FC<InnerPlayerProps> = ({
hideCover,
noWriteDocTitle,
layerContent,
crossOrigin,
}) => {
const {emitEvent, subscribeAction} = useContext(InternalMessageContext)
const {currentSrc, sources} = useContext(VideoSourceContext)
Expand Down Expand Up @@ -634,6 +636,7 @@ const InnerPlayer: React.FC<InnerPlayerProps> = ({
<div className={css(styles.video)}>
<Video
ref={videoRef}
crossOrigin={crossOrigin}
controls={ua.isMobile && isPlaybackStarted && !hideMobileControls}
paused={!isPlaying}
volume={volume}
Expand Down
2 changes: 2 additions & 0 deletions packages/griffith/src/components/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class Video extends Component<VideoProps> {
useMSE,
sources,
currentQuality,
crossOrigin,
} = this.props

const {VideoComponent} = selectVideo(format, useMSE)
Expand All @@ -355,6 +356,7 @@ class Video extends Component<VideoProps> {
className={css(styles.root)}
preload="metadata"
playsInline
crossOrigin={crossOrigin}
webkit-playsinline=""
x-webkit-airplay="deny"
muted={!volume}
Expand Down

0 comments on commit 68c65bb

Please sign in to comment.