videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.18k stars 7.47k forks source link

Unable to play flv videos on a local html. #3324

Closed Zzzen closed 8 years ago

Zzzen commented 8 years ago

Description

Videojs doesn't work if I open a local html.

Steps to reproduce

  1. create a index.html on your machine. ( important! Don't use jsbin. )
  2. set the content of it:
<head>
<link href="http://vjs.zencdn.net/5.8/video-js.min.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/5.8/video.min.js"></script>
</head>

<body>
  <video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup="{}">
    <source src="http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv" type='video/x-flv'>
    <p class="vjs-no-js">
      To view this video please enable JavaScript, and consider upgrading to a web browser that
      <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
  </video>

  <script src="http://vjs.zencdn.net/5.9.2/video.js"></script>
</body> 
  1. double click to open it.

    Results

    Expected

It should play when I click the giant play button.

Actual

Nothing happens, there is even no error output on console.

Error output

No output

Additional Information

video-js.swf was loaded successfuly

versions

videojs

5.8

browsers

Chrome, firefox, edge

OSes

windows10 64.

plugins

No plugins.

gkatsev commented 8 years ago

Unfortunately, that is a limitation of flash and not videojs. It won't really load properly when loaded in over the file: protocol. We strongly recommend to use local web servers when working with anything dealing with flash, and even when working with websites locally as well.

Zzzen commented 8 years ago

Do you know any workaround? I want to videojs and electron to make a player.

gkatsev commented 8 years ago

Why not run a local webserver and load it over that?

Zzzen commented 8 years ago

Interesting. I'll try it.

Zzzen commented 8 years ago

It has a severe problem that seeking is not available until whole file is "downloaded". I'm using a server mentioned in http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js#answer-28972079

gkatsev commented 8 years ago

If seeking isn't available until the whole file has loaded that means that the file metadata is at the end of the file and there isn't much you can do about it other than re-transcode (in which case, I would suggest using an mp4 or webm or something that electron/chrome supports natively).