0
votes

I'm migrating a personal portfolio website that showcases flash videos.

Everything is working fine except the videos are not playing correctly.

The site embeds a swfobject player to play .f4v flash videos.

The swfobject loads but the videos don't play.

Here is the entire code example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>SWFObject 2 dynamic publishing example page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

        <script type="text/javascript" src="swfobject.js"></script>

        <script type="text/javascript">

            function outputStatus(response) {
                console.log("response.success = " + response.success +"\nresponse.id = "+ response.id +"\nresponse.ref = "+ response.ref)
            }

            var flashvars = {
                holder: "http://127.0.0.1:8000/media/uploads/stills/XMAS-H264.jpg",
                bg: '',
                file: "Xmas_instrumental_2.f4v",
                autoplay: 'false'
            }
            var playerId = "myContent";
            var params = { wmode: 'transparent' }
            swfobject.embedSWF('player_12.swf', playerId, '960', '540', '10.0.0', 'expressInstall.swf', flashvars, params, null, outputStatus);
        </script>
    </head>
    <body>
        <div id="myContent">
            <h1>Alternative content</h1>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
        </div>
    </body>
</html>

The console response I get in the outputStatus function is:

response.success = true
response.id = myContent
response.ref = [object HTMLObjectElement] 

Which seems to indicated that the flash player is loading, but just unable to play the videos.

Is this an issue with the 'player_12.swf' object I'm trying to use to play the videos?

How can I properly diagnose what's wrong? How can I get this to work properly?

This question [play FLV video in a SWF object ] suggests that I need to either go with a 3rd party hosted solution (this is not an option) or to build a SWF that can play the videos.

Given the answer is a few years old, I want to see if there's a better current solution (or a good swf tutorial recommendation).

Thanks for your help!

1

1 Answers

0
votes

The answer in the other thread is still accurate. SWFObject only embeds SWF files, it doesn't embed (or play) FLV files. It is not a player, it just automates the creation of markup in your HTML.

The code below indicates the markup was correctly added to the page, even if the SWF isn't doing what you expect it to do. In other words, SWFObject did its job.

response.success = true
response.id = myContent
response.ref = [object HTMLObjectElement] 

As stated in the other thread, in order to play FLV files you will need to build a custom SWF for loading and controlling the FLV, or use a pre-built video player like JW Player or Flowplayer. The 3rd-party player doesn't have to be hosted on a 3rd-party site, I think you misinterpreted the response there. You can easily retain control all of the files and serve them from your own server.

As for why "player_12.swf" isn't working, we can't answer that without studying the ActionScript inside the SWF. Honestly, there's really no reason to reinvent the wheel, I'd go with a 3rd-party player since they've spent countless hours debugging and perfecting their players and have much more experience in the field than you or I do.