0

I was trying to embed a flash video using javascript in html .

<!DOCTYPE html>
<html>
    <head>
        <title>Adding a Flash Video</title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
        <script type="text/javascript">
            var flashvars = {};
            var params = {
            movie:"../video/puppy.flv" };
            swfobject.embedSWF("flash/osplayer.swf", "snow", "400", "345", "8.0.0", flashvars, params);
            </script>
    </head>
    <body>
        <div id="snow">
            <p>A video of a puppy playing in the snow</p>
        </div>
    </body>
</html>

I had a doubt in the directory structure. The directory structure is like the photo attached. In line no. 9 the path is like movie:"../video/puppy.flv" but the video is stored in video folder as shown in the image. So ideally the path should be movie:"/video/puppy.flv". But when i change the path to movie:"../video/puppy.flv" the video not plays.enter image description here

1
  • So you tried changing it to movie:"video/puppy.flv"? Also, which file is this code contained in? (ie it's location) Commented Feb 15, 2016 at 17:17

2 Answers 2

1

if the path is within the html and css folder then your path should be video/puppy.flv

Sign up to request clarification or add additional context in comments.

1 Comment

Yes the path is in the html and css folder, but when i put the path as "video/puppy.flv" it does'nt works.
1

Your screenshot shows the puppy.flv is in the root directory "html and css", not the "movies" subdirectory. If it is this file you are trying to request, then I would recommend either "/puppy.flv" or possibly "../puppy.flv" as it's being called by a flash script in a different subfolder.

Otherwise, move the puppy.flv file into the "videos" folder.

7 Comments

Its exact same copy is in the video folder.
I've taken the code you've given in the initial post and put it in my own HTML file, along with a sample FLV and the osplayer.swf file with it - This works with both "../video/puppy.flv" and "/video/puppy.flv" What errors are you seeing in your Browser console? (in Chrome, hit F12 whilst viewing the tab you are testing)
Failed to load resource: net::ERR_FILE_NOT_FOUND , I am getting this type of error.
Is this HTML page being hosted in an application server anywhere? or have you simply opened the HTML file directly in a browser? (i.e. double clicked the HTML file) - The latter will likely not work without the absolute path to the file in the Operating system.
I think the problem here is that by opening the HTML file directly, Chrome will use the file:// protocol instead of http:// - so by setting it to /video/puppy.flv, you're actually requesting file:///video/puppy.flv which is not necessarily correct. By specifying the "../" at the beginning of the path, Chrome will automatically start navigating from the place you've opened the HTML file.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.