import {Video} from "@tarojs/components";
import {FC} from "react";
import Taro from "@tarojs/taro";
import styles from './videoFull.module.scss'

interface Props {
  url: string
}

const VideoFull: FC<Props> = () => {
  const {url} = Taro.useRouter().params

  Taro.useLoad(() => {
    if (!url) {
      Taro.showModal({
        title: '播放地址错',
        success(){
          Taro.navigateBack()
        }
      })
    }
  })

  return (
    <Video
      className={styles.video}
      controls
      src={url!}
      autoplay
      showCenterPlayBtn
      enablePlayGesture
      autoPauseIfOpenNative
      autoPauseIfNavigate
      showFullscreenBtn={false}
      enableProgressGesture={false}
    />
  )
}

export default VideoFull
