node-mpv 超级厉害的播放器,兼容所有格式,速度超快

福尔摩斯对我笑 2019-05-20 322 次 9条

mpv是一个基于MPlayer和mplayer2的媒体播放器。它支持各种视频文件格式,音频和视频编解码器以及字幕类型。特殊输入URL类型可用于从磁盘文件以外的各种源读取输入。根据平台,支持各种不同的视频和音频输出方法。

使用node调用

  • 安装node-mpv
  • 代码
    let mpv = require('node-mpv');
    let mpvPlayer = new mpv({
    "verbose": true,
    // "audio_only": true, //仅播放声音
    "binary": "mpv-x86_64/mpv.exe"
    },
    [
    "--fullscreen",
    "--fps=60"
    ]);
    mpvPlayer.load("58.mp4")
    

binary为你的exe路径,去官网下载就可以使用

  • 循环播放
    play(arr)
    function play(arr){
    mpvPlayer.load("")
    for(let i = 0; i< arr.length; i++){
    mpvPlayer.append(arr[i]);
    }
    }
    mpvPlayer.on('stopped', function() {
    play(arr)
    });
    
  • 利用第三方平台播放,比如electron
    
    let mpvPlayer = new mpv({
    "binary": path.join(__dirname, "mpv-x86_64/mpv.exe")
    },
    [
    "--wid=" + playerHWND  //electron的实例
    ]);
    
    
  • 相关资料

    https://mpv.io/ https://github.com/00SteinsGate00/Node-MPV

标签: 无

非特殊说明,本博所有文章均为博主原创。

头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 9 条评论 1


  1. bird deterrent products

    I quite like looking through an article that will make
    men and women think. Also, many thanks for allowing for me to comment!

    回复 2020年2月16日
  2. ig

    It’s awesome designed for me to have a web site, which
    is valuable in support of my know-how. thanks admin

    回复 2020年2月14日
  3. Grace

    For the reason that the admin of this site is working, no question very rapidly it will be well-known, due to its feature
    contents.

    回复 2020年2月12日
  4. efftlab.ru

    Thank you for the good writeup. It in fact was a amusement account it.

    Look advanced to far added agreeable from you! By the way,
    how can we communicate?

    回复 2020年2月11日
  5. www.creatiblogs.es

    What’s up every one, here every person is sharing such knowledge, so
    it’s good to read this blog, and I used to pay a quick visit this weblog
    every day.

    回复 2020年2月9日
  6. http://www.gooptic.com

    Hello there! Would you mind if I share your blog with my facebook group?

    There’s a lot of people that I think would really enjoy your content.

    Please let me know. Cheers

    回复 2020年2月8日
  7. magazin01.ru

    I am no longer certain where you are getting your info, but good topic.
    I needs to spend a while finding out more or understanding more.
    Thank you for fantastic info I was searching for
    this information for my mission.

    回复 2020年2月8日
  8. http://www.yudian.cc/link.php?url=https://vimeo.com/brookwoodcamps

    I know this if off topic but I’m looking into starting my own weblog and was curious what all is needed to get set up?
    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% sure. Any recommendations or advice would be greatly appreciated.

    Thank you

    回复 2020年2月7日
  9. Novella

    This is my first time pay a visit at here and i am actually happy
    to read everthing at one place.

    回复 2020年2月4日