flvjs api 中文[通俗易懂]

flvjs api 中文[通俗易懂]flvjs.createPlayer()functioncreatePlayer(mediaDataSource:MediaDataSource,config?:Config):Player;MediaDataSource Field Type Description type string Indicatesmediatype,’flv’or’mp4′ isLive? boolean Indic…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

翻译自用,欢迎纠错、补充

原文:https://github.com/bilibili/flv.js/blob/master/docs/api.md

 

主要方法: flvjs.createPlayer()

function createPlayer(mediaDataSource: MediaDataSource, config?: Config): Player;

Jetbrains全家桶1年46,售后保障稳定

* 带?号符号的是非必选项

MediaDataSource

Field

Type Description 中文
type string Indicates media type, 'flv' or 'mp4' 类型
isLive? boolean Indicates whether the data source is a live stream 是否直播
cors? boolean Indicates whether to enable CORS for http fetching 跨域
withCredentials? boolean Indicates whether to do http fetching with cookies 是否携带COOKIES
hasAudio? boolean Indicates whether the stream has audio track 开启声音
hasVideo? boolean Indicates whether the stream has video track 开启图像
duration? number Indicates total media duration, in milliseconds 媒体时间总长度,毫秒
filesize? number Indicates total file size of media file, in bytes 文件大小
url? string Indicates media URL, can be starts with 'https(s)' or 'ws(s)' (WebSocket) 媒体网络地址
segments? Array<MediaSegment> Optional field for multipart playback, see MediaSegment 媒体列表

如果segments参数存在, 则将播放器列为多源媒体播放。

如果是多源媒体播放,则durationfilesizeurl 这三个参数将被忽略。

MediaSegment

Field Type Description 中文
duration number Required field, indicates segment duration in milliseconds 媒体时间总长度,毫秒
filesize? number Optional field, indicates segment file size in bytes 文件大小
url string

Required field, indicates segment file URL

媒体网络地址

Config

Field Type Default Description 中文
enableWorker? boolean false Enable separated thread for transmuxing (unstable for now) 多线程工作?
enableStashBuffer? boolean true Enable IO stash buffer. Set to false if you need realtime (minimal latency) for live stream playback, but may stalled if there’s network jittering. 启用缓存
stashInitialSize? number 384KB Indicates IO stash buffer initial size. Default is 384KB. Indicate a suitable size can improve video load/seek time. 缓存大小
isLive? boolean false Same to isLive in MediaDataSource, ignored if has been set in MediaDataSource structure. 是否直播,会覆盖上面的配置
lazyLoad? boolean true Abort the http connection if there’s enough data for playback. 懒加载,如果缓存到足够的秒数,则停止下载
lazyLoadMaxDuration? number 3 * 60 Indicates how many seconds of data to be kept for lazyLoad. 懒加载最多的秒数
lazyLoadRecoverDuration? number 30 Indicates the lazyLoad recover time boundary in seconds. 缓存剩余秒数时继续下载
deferLoadAfterSourceOpen? boolean true Do load after MediaSource sourceopen event triggered. On Chrome, tabs which be opened in background may not trigger sourceopen event until switched to that tab.  
autoCleanupSourceBuffer boolean false Do auto cleanup for SourceBuffer 自动清理缓存
autoCleanupMaxBackwardDuration number 3 * 60 When backward buffer duration exceeded this value (in seconds), do auto cleanup for SourceBuffer  
autoCleanupMinBackwardDuration number 2 * 60 Indicates the duration in seconds to reserve for backward buffer when doing auto cleanup.  
fixAudioTimestampGap boolean true Fill silent audio frames to avoid a/v unsync when detect large audio timestamp gap. 填补无音频帧
accurateSeek? boolean false Accurate seek to any frame, not limited to video IDR frame, but may a bit slower. Available on Chrome > 50FireFox and Safari. 精确寻帧到任何帧,不局限于视频IDR帧,但可能会慢一点。可在Chrome >火狐和Safari浏览器。
seekType? string 'range' 'range' use range request to seek, or 'param' add params into url to indicate request range.  
seekParamStart? string 'bstart' Indicates seek start parameter name for seekType = 'param'  
seekParamEnd? string 'bend' Indicates seek end parameter name for seekType = 'param'  
rangeLoadZeroStart? boolean false Send Range: bytes=0- for first time load if use Range seek 发送范围:Range: bytes=0- 如果使用范围查找第一次加载
customSeekHandler? object undefined Indicates a custom seek handler 指示自定义查找处理程序
reuseRedirectedURL? boolean false Reuse 301/302 redirected url for subsequence request like seek, reconnect, etc. 重用301/302重定向url,用于随后的请求,如查找、重新连接等。
referrerPolicy? string no-referrer-when-downgrade Indicates the Referrer Policy when using FetchStreamLoader 指示使用FetchStreamLoader时的引用方策略
headers? object undefined Indicates additional headers that will be added to request 添加请求头

method:

    constructor(mediaDataSource: MediaDataSource, config?: Config): Player;
    destroy(): void;
    on(event: string, listener: Function): void;
    off(event: string, listener: Function): void;
    attachMediaElement(mediaElement: HTMLMediaElement): void;
    detachMediaElement(): void;
    load(): void;
    unload(): void;
    play(): Promise<void>;
    pause(): void;
    type: string;
    buffered: TimeRanges;
    duration: number;
    volume: number;
    muted: boolean;
    currentTime: number;
    mediaInfo: Object;
    statisticsInfo: Object;

官方找不到方法的说明。。

 

自己看的,请大家指错。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/200696.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 如何在pycharm中安装pygame_python安装pycharm的方法

    如何在pycharm中安装pygame_python安装pycharm的方法今天好不容易啃书到项目实践过程,终于可以做一款小游戏了,这对我这个Python编程小白来说,无疑是自己一直想要去实现的。正准备兴致勃勃的准备撸代码时,就开始碰壁了,因为在安装pygame,我按照书中步骤来时,却永远安不上,可能是书的问题也可能是我自己哪部分搞错了,于是去搜了一下百度,虽然有很多办法,但无一都很复杂,写了一大堆,最终在我自我摸索下,终于搞好了,现在分享一下我的下载过程,超级简单:1、首先打开pycharm,再点击Terminal终端,在终端输入:pipinstallpygame即可

    2022年8月29日
    3
  • FastCGI介绍

    FastCGI介绍本文主要介绍FastCGI的相关知识。有关CGI的知识,点击此处查看。1.概述FastCGI实际上是增加了一些扩展功能的CGI、是CGI的改进,描述了客户端和Web服务器程序之间传输数据的一种标准。FastCGI致力于减少Web服务器与CGI程序之间进行互动的开销,从而使Web服务器可以同时处理更多的Web请求。与CGI为每个Web请求创建一个新的进程不同,…

    2022年7月11日
    25
  • Django(55)GenericAPIView源码分析

    Django(55)GenericAPIView源码分析源码分析GenericAPIView继承自APIView,也就是在APIView基础上再做了一层封装,源码如下:classGenericAPIView(views.APIView):query

    2022年7月30日
    3
  • 一个贼简单的代码表白

    一个贼简单的代码表白前一阵网上挺火的各种表白代码,自己学着也做了一个记事本编写,后缀改为vbs就能运行了。(其中有一串代码会关机的呦,我是WIN10系统)setws=createobject(“wscript.shell”)ws.run”cmd.exe/cshutdown-s-f-t0″哈哈知道三号女生是什么梗吗?(来源于文松的一个小品,那个老弟啊姐给你爆灯的那个!!嗯哼)就是…

    2022年5月6日
    48
  • 软件架构学习小结

    软件架构学习小结

    2021年11月15日
    73
  • Oracle12c(PDB中) ORA-01017: invalid username/password; logon denied

    Oracle12c(PDB中) ORA-01017: invalid username/password; logon denied问题背景描述:SQL>altersessionsetcontainer=pdbwyzc;–切换pdbSQL>defineusername=eodaSQL>defineusernamepwd=fooSQL>createuser&&usernameidentifiedby&&usernamepwd;SQL>grantdbato&&username;

    2022年5月6日
    77

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号