html5 video player,GitHub - paypal/accessible-html5-video-player: Accessible HTML5 Video Player

Accessible HTML5 Video Player

68747470733a2f2f7261776769742e636f6d2f616c65656e34322f6261646765732f6d61737465722f7372632f70617970616c2e737667

68747470733a2f2f63646e2e7261776769742e636f6d2f616c65656e34322f6261646765732f6d61737465722f7372632f6a6176617363726970742e737667

What is it?

A lightweight HTML5 video player which includes support for captions and screen reader accessibility. For details, read the blog post Introducing an Accessible HTML5 Video Player on the PayPal Engineering blog (updated link). Also see 7 Lessons from Developing an Accessible HTML 5 Video Player.

Features

Provides an HTML5 video player with custom controls.

Supports captions; simply denote a VTT caption file using the standard HTML5 video syntax.

Uses native HTML5 form controls for volume (range input) and progress indication (progress element).

Accessible to keyboard-only users and screen reader users.

Option provided to set captions on or off by default (upon loading).

Option provided to set number of seconds by which to rewind and forward.

Text strings for the controls are externalized to allow for internationalization (fall 2015).

No dependencies. Written in "vanilla" JavaScript.

When JavaScript is unavailable, the browser's native controls are used.

React support

Implementation

CSS and Image

Insert the CSS in the Head of your HTML document. You'll also need to upload the sprite image (or use your own) and adjust the path in the CSS file.

HTML

Insert the HTML5 video markup in the Body of your HTML document. Replace the video, poster, and caption URLs. Modify the sizes of video and fallback image as needed.

download video

JavaScript

Insert two JavaScript files right before the closing Body element of your HTML document. Add a Script element to initialize the video. Options are passed in JSON format. The options are:

option

description

dataType

default

videoId

the value of the ID of the widget container

string

required

captionsOnDefault

denotes whether to show or hide caption upon loading

boolean

optional

true

seekInterval

the number of seconds to rewind and fast forward

number

optional

10

videoTitle

short title of video; used for aria-label attribute on Play button to clarify to screen reader user what will be played

string

optional

Play

debug

turn console logs on or off

boolean

optional

false

// Initialize

new InitPxVideo({

"videoId": "myvid",

"captionsOnDefault": true,

"seekInterval": 20,

"videoTitle": "clips of stand-up comedy",

"debug": true

});

React Version

The React version has been designed to be integrated into your react codebase easily. The video React component is named PXvideo and has the below API:

sources={[

'https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.mp4',

'https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.webm'

]}

caption={{

label: 'English captions',

source: 'media/captions_PayPal_Austin_en.vtt',

lang: 'EN',

default: true

}}

poster="media/poster_PayPal_Austin2.jpg"

width="640"

height="360"

controls={true}

id="myvid"

fallback={true}

seekInterval={20}

debug={true}

/>

A demo could be reached at: View Demo

Development

npm install // install dependencies

npm run react // transpile .jsx into valid .js using Babel

Feedback and Contributions

If you experience any errors or if you have ideas for improvement, please feel free to open an issue or send a pull request.

You can also follow and contact the PayPal Accessibility team on Twitter: @PayPalInclusive No longer exists.

Authors/Maintainer

Victor Tsaran (consultation and testing) || https://github.com/vick08 || @vick08

Jason Gabriele (consultation)

Tim Resudek (design)

Browser Support

Chrome: full support.

Safari: full support.

Firefox: full support.

Internet Explorer 10, 11: full support.

Internet Explorer 9: native video player used (aesthetic choice since HTML5 range input and progress element are not supported).

Internet Explorer 8: renders fallback content of video element (in the demo, this is an image linked to the video file).

Smartphones and tablets: controls and captions are not customized as both are natively supported in latest versions.

Limitations and Known Issues

Currently, only one caption file per video is supported.

Only VTT caption files are supported (not SRT nor TTML). VTT cue settings are not supported but inline styles function (see first few lines of example).

The controls have a minimum width of 360px.

Related Resources

Simple SubRip to WebVTT converter - tool to convert SRT captions to WebVTT

Able Player - accessible cross-browser media player by Terrill Thompson

Projects influenced by the PayPal Accessible HTML5 Video Player

Universal Video Player - by Ind.ie, @LauraKalbag

Plyr - by @sam_potts, @selz

Copyright and License

Copyright 2019, PayPal under the BSD license.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值