flv.js 中文文档

JavaScript019

flv.js 中文文档,第1张

<article class="_2rhmJa">

本文档使用类似TypeScript的定义来描述接口。

flv.js将所有接口都以flvjs对象暴露在全局上下文window中.

flvjs 还可以通过require或ES6导入来访问对象。

方法:

类:

枚举:

根据中指定的type字段创建一个播放器实例mediaDataSource(可选)config。

如果segments存在字段,则transmuxer会将其MediaDataSource视为多部分源。

在多部分模式下,结构中的duration filesize url字段MediaDataSource将被忽略。

如果基本上可以再您的浏览器上播放则返回true

返回FeatureList具有以下详细信息的对象:

实现Player接口的FLV播放器。可以通过new操作进行创建

Player wrapper for browser's native player (HTMLVideoElement) without MediaSource src, which implements the Player interface. Useful for singlepart MP4 file playback.

A global interface which include several static getter/setter to set flv.js logcat verbose level.

一个全局接口,其中包括几个用于设置flv.js logcat详细级别的静态getter / setter。

一系列可以和 Player.on() / Player.off() 一起使用的常数. 它们需要前缀 flvjs.Events .

播放期间可能出现的错误。它们需要前缀flvjs.ErrorTypes。

针对网络和媒体错误提供更详细的说明。它们需要前缀flvjs.ErrorDetails。

</article>

4人点赞

日记本

Sortable is a JavaScript library for reorderable drag-and-drop lists.

Demo: http://sortablejs.github.io/Sortable/

Install with NPM:

Install with Bower:

Import into your project:

Cherrypick plugins:

You can use any element for the list and its elements, not just ul / li . Here is an example with div s .

To drag elements from one list into another, both lists must have the same group value. You can also define whether lists can give away, give and keep a copy ( clone ), and receive elements.

Demo:

允许在列表内部排序。

Demo: https://jsbin.com/jayedig/edit?js,output

Time in milliseconds to define when the sorting should start. Unfortunately, due to browser restrictions, delaying is not possible on IE or Edge with native drag &drop.

Demo: https://jsbin.com/zosiwah/edit?js,output

Whether or not the delay should be applied only if the user is using touch (eg. on a mobile device). No delay will be applied in any other case. Defaults to false .

Percentage of the target that the swap zone will take up, as a float between 0 and 1 .

Read more

Demo: http://sortablejs.github.io/Sortable#thresholds

Set to true to set the swap zone to the sides of the target, for the effect of sorting "in between" items.

Read more

Demo: http://sortablejs.github.io/Sortable#thresholds

Percentage of the target that the inverted swap zone will take up, as a float between 0 and 1 . If not given, will default to swapThreshold .

Read more

Direction that the Sortable should sort in. Can be set to 'vertical' , 'horizontal' , or a function, which will be called whenever a target is dragged over. Must return 'vertical' or 'horizontal' .

Read more

Example of direction detection for vertical list that includes full column and half column elements:

This option is similar to fallbackTolerance 选项.

When the delay 选项 is set, some phones with very sensitive touch displays like the Samsung Galaxy S8 will fire unwanted touchmove events even when your finger is not moving, resulting in the sort not triggering.

This option sets the minimum pointer movement that must occur before the delayed sorting is cancelled.

Values between 3 to 5 are good.

Disables the sortable if set to true .

Demo: https://jsbin.com/sewokud/edit?js,output

To make list items draggable, Sortable disables text selection by the user. That's not always desirable. To allow text selection, define a drag handler, which is an area of every list element that allows it to be dragged around.

Demo: https://jsbin.com/numakuh/edit?html,js,output

Class name for the drop placeholder (default sortable-ghost ).

Demo: https://jsbin.com/henuyiw/edit?css,js,output

Class name for the chosen item (default sortable-chosen ).

Demo: https://jsbin.com/hoqufox/edit?css,js,output

If set to true , the Fallback for non HTML5 Browser will be used, even if we are using an HTML5 Browser. This gives us the possibility to test the behaviour for older Browsers even in newer Browser, or make the Drag 'n Drop feel more consistent between Desktop , Mobile and old Browsers.

On top of that, the Fallback always generates a copy of that DOM Element and appends the class fallbackClass defined in the options. This behaviour controls the look of this 'dragged' Element.

Demo: https://jsbin.com/sibiput/edit?html,css,js,output

Emulates the native drag threshold. Specify in pixels how far the mouse should move before it's considered as a drag. Useful if the items are also clickable like in a list of links.

When the user clicks inside a sortable element, it's not uncommon for your hand to move a little between the time you press and the time you release. Dragging only starts if you move the pointer past a certain tolerance, so that you don't accidentally start dragging every time you click.

3 to 5 are probably good values.

If set to true , the dragover event will bubble to parent sortables. Works on both fallback and native dragover event. By default, it is false, but Sortable will only stop bubbling the event once the element has been inserted into a parent Sortable, or can be inserted into a parent Sortable, but isn't at that specific time (due to animation, etc).

Since 1.8.0, you will probably want to leave this option as false. Before 1.8.0, it may need to be true for nested sortables to work.

If set to false , the clone is hidden by having it's CSS display property set to none . By default, this option is true , meaning Sortable will remove the cloned element from the DOM when it is supposed to be hidden.

The distance (in pixels) the mouse must be from an empty sortable while dragging for the drag element to be inserted into that sortable. Defaults to 5 . Set to 0 to disable this feature.

Demo: https://jsbin.com/becavoj/edit?js,output

Get or set the option.

For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

Serializes the sortable's item data-id 's ( dataIdAttr 选项) into an array of string.

Sorts the elements according to the array.

Save the current sorting (see store )

Removes the sortable functionality completely.

Saving and restoring of the sort.

Demo: https://jsbin.com/visimub/edit?html,js,output

Create new instance.

The active Sortable instance.

The element being dragged.

The ghost element.

The clone element.

Get the Sortable instance on an element.

Mounts a plugin to Sortable.

js中文乱码解决办法:设置charset=utf-8,完成。

①.js 文件中文显示乱码Javascript文件XX.js编辑保存时有一种编码方案(如GBK)当打开文件的时候所用的编码(如UTF-8)和保存时的编码方案不一致时,则会出现中文显示乱码。

解决方案:

(1)用编辑器打开浏览的时候,选择和原文件编码(如GBK)一致的编码方式查看,则不会出现乱码

(2)在eclipse中的package explorer中选中乱码的XX.js,右键菜单中选择properties,在Text file encoding中选择与XX.js编辑保存时的编码(如GBK),则可以正常显示。

②网站页面中JavaScript中中文字段乱码 在eclipse或者编辑器中XX.js中中文显示正常,在页面调用XX.js,执行后页面结果中中文字段显示乱码。

解决方案: 在引用XX.js的页面上“显示”加上XX.js文件的编码方式,使之与XX.js文件的本身的编码方式(如GBK)保持一致。<scripttype="text/javascript" language="JavaScript" src="/js/XX.js" charset=“GBK” </script建议:

1)在用Eclipse或者Myeclipse新建XX.js,进行编辑时,建议先将Textfile encoding改为UTF-8,然后进行编辑保存。

2)用文本文档或者其他编辑器编辑保存XX.js,建议以UTF-8的编码方式保存。

3)在引用XX.js的页面上“显示”加上XX.js文件的编码方式UTF-8。<scripttype="text/javascript" language="JavaScript" src="/js/XX.js".