how to play flash(.flv) video using video.js in chrome

本小妞迷上赌 提交于 2019-12-04 10:27:38

video.js can play FLV in the Flash tech.

If you're self-hosting video.js rather than using the CDN, make sure the path to your swf is correct, e.g.

<script>
  videojs.options.flash.swf = "http://example.com/path/to/video-js.swf"
</script>

Make sure to use the correct video/x-flv mime type in the source tag:

<source src="http://example.com/video.flv" type='video/x-flv'>

The server hosting the FLV must also return the correct mime type in the 'Content-Type` header.

Example: http://output.jsbin.com/juvuca

You should use flv.js, an HTML5 FLV Player written in pure JavaScript. No Flash is required.

https://github.com/Bilibili/flv.js

You can make a source handler to integrate flv.js with video.js

You can find the plugin here -https://github.com/videojs/video.js/wiki/Plugins Not sure if this will work.

If not try this as well -http://jsfiddle.net/N8Zs5/18/

Regards, Shashi

Two ways.

You can choose one of them to support playing flv video. Also, you can use both of them and specify their order by techOrder option.

data-setup='{"techOrder":["html5", "flvjs", "flash"]}'

this project may help you, https://github.com/mister-ben/videojs-flvjs

<!-- Video.js -->
<link href="//path/to/video-js.css" rel="stylesheet">
<script src="//path/to/video.min.js"></script>
<!-- flv.js -->
<script src="//path/to/flv.min.js"></script>
<!-- videojs-flvjs -->
<script src="//path/to/videojs-flvjs.min.js"></script>
<video id="videojs-flvjs-player" class="video-js vjs-default-skin" controls>
  <source src="movie.flv" type='video/x-flv'>
</video>
<script>
  // For v5 the tech must be added to the tech order.
  // For v6 this is not needed.
  videojs('videojs-flvjs-player', {
    techOrder: ['html5', 'flvjs'],
    flvjs: {
      mediaDataSource: {
        isLive: true,
        cors: true,
        withCredentials: false,
      },
      // config: {},
    },
  });
</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!