Can CSS be applied to element

前端 未结 6 1847
余生分开走
余生分开走 2021-01-07 05:17

So I ran into problem while writing my own customized HTML5 video player. Can any CSS rules be applied to element? Any nasty hacks? I want to cont

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-07 06:16

    While normally you can't style the track with just plain old CSS, you can use VideoJS to do it. The JavaScript and CSS used for the VideoJS video player allows the track to be styled. You will want to tryout everything using FireFox because (currently) Chrome doesn't allow the track to be shown unless it's already on a server. And I assume you're working offline with your HTML files.

    Head over to http://www.videojs.com/ and download the files. Extract the files from the .zip and open video-js.css. Go down to the bottom into the REQUIRED STYLES (be careful overriding) section and find /* Text Track Styles */. A little below you will find .vjs-caption-settings. In the middle of this CSS you will see color: #FFF; and font-size: 12px;. Have fun switching up the colors.

    I hope you, and everybody else, will find this useful.

    Map of the VideoJS files:

    1. demo.captions.vtt subtitles. needed
    2. demo.html needed
    3. font folder used with CSS
    4. lang language folder. not really needed
    5. video-js.css edit thid file. needed
    6. video-js.less collapsed CSS. not needed
    7. video-js.min.css collapsed CSS. not needed
    8. video-js.swf flash fallback for older browsers. optional
    9. video.dev.js the expanded JS. replace video.js with this if you want. needed if not using #10
    10. video.js collapsed JS. the HTML page uses this. replace it with video.dev.js. needed if not using #9
    11. video.novtt.dev.js not needed
    12. video.novtt.js not needed

提交回复
热议问题