html5 播放ts,GitHub - tstabla/stVideo: HTML5 video canvas player. Prevents video fullscreen on iPhone/...

HTML5 video canvas player. Prevents video fullscreen on iPhone/iPad.

How to use

Just create div where canvas or video element will be inserted.

Optionally you can add attribute with params.

Then create new object.

var video = new stVideo( '#player' );

Or create new object with params, if you not added them to HTML element.

var video = new stVideo( '#player', {

"mp4" : "filename.mp4", //recommended

"webm" : "filename.webm", //recommended

"ogg" : "filename.ogg",

"width" : 524, //required

"height": 270, //required

"force" : "", //'video' or 'canvas',

"framesPerSecond": 30, //needed for canvas refresh, default 30

"volume": 1 //default

} );

Look at the table below, and best use .mp4 and .webm video files format.

.mp4

.webm

.ogg

Android

X

X

iPhone

X

Firefox

X

X

Chrome

X

X

Safari

X

IE >= 9

X

IE Mobile

X

At the end, you can play video immediately after initialization.

video.on( 'canplaythrough', function() {

video.play();

} );

You can attach other events from list http://www.w3.org/TR/html5/embedded-content-0.html#mediaevents but some of them may not work properly with canvas video for ex. "volumechange".

Examples:

video.on( 'play', function() {

console.log( 'play' );

} );

video.on( 'pause', function() {

console.log( 'pause' );

} );

video.on( 'end', function() {

console.log( 'end' );

} );

Events

video.play(); //play video

video.pause(); //pause video

video.on( 'name', function(){} ); //for attach event

video.destroy(); //not working - future function to remove player

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值