Skip to content

Commit

Permalink
feat: 透传 video 标签 crossorigin
Browse files Browse the repository at this point in the history
  • Loading branch information
xiabaoying committed Mar 15, 2024
1 parent fc20672 commit c0547fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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
}

// 仅供 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
3 changes: 3 additions & 0 deletions packages/griffith/src/components/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type VideoProps = NativeVideoProps & {
onEvent: (name: EVENTS, data?: unknown) => void
currentPlaybackRate: PlaybackRate
useAutoQuality?: boolean
crossorigin?: string
}

class Video extends Component<VideoProps> {
Expand Down Expand Up @@ -342,6 +343,7 @@ class Video extends Component<VideoProps> {
useMSE,
sources,
currentQuality,
crossorigin,
} = this.props

const {VideoComponent} = selectVideo(format, useMSE)
Expand All @@ -355,6 +357,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 c0547fd

Please sign in to comment.