admin管理员组

文章数量:1322171

I've a little video.js player and i'm new to web devlopment. I want it to read my local videos but i've a message: "Sorry no patible source and playback technology were found for this video."

But: If i use the external link given by video.js as sample, i can read the video.

I downloaded some samples to try out. An OGV one worked on the website i downloaded it. But when i try with my own, it doesn't work and show the same error.

Here is the .jsp code :

   <div id="videoPlayer">
        <video id="videoClip" class="video-js vjs-default-skin"
               controls preload="auto" width="640" height="360"
               poster=".png"
               data-setup='{"example_option":true}'>


            <source src="/home/ogda/Bureau/war/src/main/resources/small.ogv type=video/ogg" />
        </video>
    </div>


    <script type="text/javascript" language="javascript">
        var videoPlayer = videojs("videoClip");
        videoPlayer.on("pause", changeVideo);
        //videoPlayer.src("/home/ogda/Bureau/war/src/main/resources/lol.mp4");
        videoPlayer.play();
    </script>

Thank you !

EDIT : ANSWER

Commenters were right. The solution was siomply to put the videos on a webserver !

I've a little video.js player and i'm new to web devlopment. I want it to read my local videos but i've a message: "Sorry no patible source and playback technology were found for this video."

But: If i use the external link given by video.js as sample, i can read the video.

I downloaded some samples to try out. An OGV one worked on the website i downloaded it. But when i try with my own, it doesn't work and show the same error.

Here is the .jsp code :

   <div id="videoPlayer">
        <video id="videoClip" class="video-js vjs-default-skin"
               controls preload="auto" width="640" height="360"
               poster="http://video-js.zencoder./oceans-clip.png"
               data-setup='{"example_option":true}'>


            <source src="/home/ogda/Bureau/war/src/main/resources/small.ogv type=video/ogg" />
        </video>
    </div>


    <script type="text/javascript" language="javascript">
        var videoPlayer = videojs("videoClip");
        videoPlayer.on("pause", changeVideo);
        //videoPlayer.src("/home/ogda/Bureau/war/src/main/resources/lol.mp4");
        videoPlayer.play();
    </script>

Thank you !

EDIT : ANSWER

Commenters were right. The solution was siomply to put the videos on a webserver !

Share Improve this question edited Sep 11, 2013 at 11:52 ogdabou asked Sep 9, 2013 at 21:50 ogdabouogdabou 5922 gold badges11 silver badges42 bronze badges 1
  • I suppose that line is not supposed to be mented out? – Hanlet Escaño Commented Sep 9, 2013 at 21:54
Add a ment  | 

2 Answers 2

Reset to default 4

This is a sandbox problem. The browser does not allow loading local resources for security reasons. If you need it still, use a local webserver on your machine.

Most major browsers don't allow you to load in local files, since that poses a security error, e.g. people stealing secure files.

You need to test this on localhost, or setup some other server to test it.

Or, if you're using Chrome, you can turn on the flag that'll allow you to load in local files.

chrome --allow-file-access-from-files

run this from mand line

本文标签: javascriptvideojs unable to read local videosStack Overflow