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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 学习微机原理与接口这一篇就够了

    学习微机原理与接口这一篇就够了注意问题:由于这篇文章我是用WORD编辑的,写完以后,发现没办法转换为MD格式,所以我只能用截图的形式上传了,写这篇文章的主要目的是对微机原理与接口基础知识的一个简单梳理。…

    2022年10月2日
    0
  • CSDN社区内容创作规范

    CSDN长久以来秉持初心,致力于为广大用户提供良好的创作环境,打造健康有序的技术生态!但良好的社区环境,需各位创作者与CSDN共同维护建立!【CSDN内容创作规范】请在发文前认真阅读:如你发布的内容存在以下问题,文章将无法通过审核,违规情节严重的,将对帐号进行封号处理。请各位创作者严格遵守社区的内容创作规范,共同守护我们的社区环境!目录一、在平台发布以下相关内容审核将不予通过1、违反法律法规和相关政策2、无资质发布专业领域内容3、流量作弊4、营销/推广引流5、不文明用语6、

    2022年4月8日
    95
  • pytorch(8)– resnet101 迁移学习记录

    pytorch(8)– resnet101 迁移学习记录一、前言本篇记录使用pytorch官方resnet101实现迁移学习,迁移学习是当前深度学习领域的一系列通用的解决方案,而不是一个具体的算法模型。Pre-training+fine-tuning(预训练+调参)的迁移学习方式是现在深度学习中一个非常流行的迁移学习方式,有以下3步(1)把预训练模型当做特征提取器:TensorFlow或者Pytorch都有ImageNet上预训练好的模型,将最后一层全连接层(原始的是1000个类别或者更多)改成你自己的分类任务的种类进行输出,或…

    2022年10月6日
    0
  • docker里镜像用ipv6无法访问_虚拟服务器端口设置

    docker里镜像用ipv6无法访问_虚拟服务器端口设置前言我有一个朋友,他在Dev和Test服务器用Docker搭建了Redis供项目使用,然后今天Test环境的Redis端口访问不通了,在服务上可以正常连接,真是离了个大齐,让我们试试排查排查问题;正文端口检测lsof已确认在本地用telnetip6381访问不通,那就上服务上看看端口情况DevTestDev环境同时映射到Ipv6和Ipv4端口,Test环境仅映射到Ipv6,那基本上就可以断定是环境问题了容器状态dockerps既然端口映射

    2022年8月31日
    3
  • mac的内核_Mac编程

    mac的内核_Mac编程MAC内核编程指南-综述等

    2022年10月8日
    0
  • 最全各国人口数据,人口的高出生率与高死亡率竟然是这些国家

    最全各国人口数据,人口的高出生率与高死亡率竟然是这些国家欢迎关注天善智能,我们是专注于商业智能BI,人工智能AI,大数据分析与挖掘领域的垂直社区,学习,问答、求职一站式搞定!对商业智能BI、大数据分析挖掘、机器学习,python,R等数据领域感兴趣的同学加微信:tsaiedu,并注明消息来源,邀请你进入数据爱好者交流群,数据爱好者们都在这儿。作者:挖数腾讯数据产品经理&amp;段子手个人微信公号:w…

    2022年9月4日
    6

发表回复

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

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