JavaScript 视频播放 canvid.js

码农软件 · 软件分类 · 多媒体处理 · 2019-09-13 11:13:54

软件介绍

canvid 是个极小依赖的库,可以在 canvas 元素上播放相对较短的视频。

  • 为什么不直接使用 HTML5 视频?
    因为不能嵌入或者在 iOS 自动播放 HTML5 视频

  • 为什么比使用一个动态 GIF 更好?
    视频转换成 GIF

     效果特别不好,因为颜色的取样关系。同时,视频 GIFs 的大小非常大。GIF 不能转换成视频,动态 GIFs 不能控制播放,不能暂停或者播放,或者延迟播放。

  • 为什么只是 "相对较短" 的视频?
    iOS 限制图片的大小上限

  • 为什么没有音频?
    canvid 不支持音频,因为动态 GIF 也不支持

安装

npm

$ npm install --save canvid

git clone

$ git clone git@github.com:gka/canvid.git

使用

可以在 AMD,CommonJS 和浏览器全局中使用 canvid.js

var canvidControl = canvid({
    selector : '.video',
    videos: {
        clip1: { src: 'clip1.jpg', frames: 38, cols: 6 },
        clip2: { src: 'clip2.jpg', frames: 43, cols: 6, loops: 3 }
    },
    width: 500,
    height: 400,    loaded: function() {
        canvidControl.play('clip1');        // reverse playback
        // canvidControl.play('clip1', true);
    }
});

本文地址:https://codercto.com/soft/d/14497.html

Programming in Haskell

Programming in Haskell

Graham Hutton / Cambridge University Press / 2007-1-18 / GBP 34.99

Haskell is one of the leading languages for teaching functional programming, enabling students to write simpler and cleaner code, and to learn how to structure and reason about programs. This introduc......一起来看看 《Programming in Haskell》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具