Socket
Socket
Sign inDemoInstall

chimee-kernel

Package Overview
Dependencies
Maintainers
6
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chimee-kernel

kernel of chimee


Version published
Weekly downloads
28
increased by460%
Maintainers
6
Weekly downloads
 
Created
Source

chimee-kernel

Chimee-kernel is a manger of video decoder.

Introduction

There are so many video type in the world. Each one may have its own decoder. In that case, we need a manger to handle it. In other word, we need a uniform statute.

What's more, as chimee handle most of the logic of a video player, a decoder can be just simple. It only need to provide normal function like load, play, pause etc.

In chimee, we call these decoder as VideoKernel. As a VideoKernel, it should fit rules below.

namemeaningtypeargumentsnote
isSupportA method to tell us whether the decoder can be runned in this browserstatic methodnoneMust be a staic method
constructorThe constructor of VideoKernel, we will passed in with three arguments, an HTMLVideoElement, an Object as KernelConfig, another Object as CustomConfigmethodvideoElement: HTMLVideoElement, kernelConfig: Object, customConfig: Object
loadA method to load srcmethodsrc: string
stopLoadstop the network loadingmethodNone
startLoadResume from stopLoad or any network errormethodsrc: string
playA method to play the vidoemethodNone
pauseA method to pause the playingmethodNone
refreshA method to reload the srcmethodnone
attachMediamethodnone
seekA method to seek to a specific pointmethodsecond: number
destroyA method which will be called when we destroy the kernelmethodnone
configThe config you storedattribute
videoYou can store the video element hereattribute
onA method to listen on your video kernelmethodtype: string, handler: Function
offA method to stop listening on your video kernelmethodtype: string, handler: Function
onceA method to listen on your video kernel only one timemethodtype: string, handler: Function
emitA method to emit event on your video kernelmethodtype: string, data: any

In nowaday, we will rebuild the video kernel when user change the src.

If you support src switch on your video kernel. Please contact us, we need to add you into whitelist.

We may support use config on installKernel later.

Installation

npm install --save chimee-kernel

Usage

import ChimeeKernel from 'chimee-kernel'

var kernel = new ChimeeKernel(document.querySelector('video'),{
    src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/TL2791e64b69ea0bea234c284c694986aa.flv',
    type: 'vod',
    box: 'flv'
});

//load source
kernel.load()

Config:

FieldTypeDescription
srcStringvideo source
isLiveBoolean'false' or 'true',set video is a live stream or vod
boxStringIndicates stream box 'flv' , 'hls' , 'native' , 'mp4'
preset{[string]: Function}set kernel decoder,example: import chimeeKernelFlv for 'chimee-kernel-flv'; preset:{'flv': chimeeKernelFlv}
presetConfig{[string]: Object}custom config to some kernel decoder

Event:

FieldTypeDescription
mediaInfoObjectvideo mediaInfo
heartbeatObjectemit per-second
errorObjectkernel error

Error code FLV:

ErrnoTypeDescription
100NumberNET_ERROR
101NumberCODEC_ERROR
102NumberCANNOT_SEEK
103NumberENDOFSTREAM_ERROR
104NumberMEDIASOURCE_ERROR
105NumberSOURCEBUFFER_ERROR
106NumberSBABORT_ERROR
106NumberAPPENDBUFFER_ERROR

Keywords

FAQs

Package last updated on 17 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc