1

I have a flash video player and I am just testing to see if I can use jquery/javascript to load that player in. I am trying to make it so that I can load different players in when I need to. Anyone have any ideas on this or know if it is possible? I know my code is wrong but I don't know how else to illustrate what I want to do.

If I take the below code and simply paste it into the html of the page on startup (without trying to use javascript or jquery to load it) then my video will work fine.

$('#container').html('<div class="test"></div><script> \
/* <![CDATA[ */ \
flowplayer(".test", "player/player.swf", {   \
clip: {  \
bufferLength: "0", \
autoPlay: true, \
autoBuffering: true, \
scaling: \'scale\', \
url:\'video_handler.php?file=somefile\' \
}, \
});  \
/* ]]> */ \
<\/script>');

2 Answers 2

3

SWFObject

http://code.google.com/p/swfobject/


SWFObject is a JavaScript based flash embedding API supplying a markup based approach and a method that relies on JavaScript.

By using the supplied code generator and javascript files, it takes a few clicks to create an copy/paste-able block of code to add to your page.

The library will handle everything you would require; such as flash button prompt for those without Flash installed and a simplified bridge for javascript to flash communication.

This is seemless to the end user and developer alike and allows the freedom to manipulate the HTML/JS without resorting to republishing your flash work.


This API is so useful it is hosted on Google Ajax Libraries http://code.google.com/p/swfobject/wiki/hosted_library and modern flash IDE's leverage this code and apply this API to the published content rather than the original propriety convalescent code.

This is useful as you will now have the ability to apply your player at any time to the DOM, simply by referencing the correct JavaScript. As an example:

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

<script type="text/javascript">
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>

As you can see - this makes our life almost worth living. I understand the embed code could be more verbose, this is the essence of requirement.


Hope it helps.

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

2 Comments

@Joey - Fair enough. I've elaborated.
Your answer is too thorough not to accept haha. How do you feel about the native flowplayer embed vs swfobject? The only difference is size I suppose? flowplayer.org/demos/installation/alternate/index.html
2

flowplayer provides a javascript library to play flash videos, you can use it like below instead of appending the markup in your question.

IF you have any question related to flowplayer, I can help you.

$(function(){
 $('#container').html('<div class="test"></div>');

 flowplayer(".test", "player/player.swf", {  
    clip: {  
    bufferLength: "0", 
    autoPlay: true, 
    autoBuffering: true, 
    scaling: 'scale', 
    url:'video_handler.php?file=somefile' 
  }, 
 });  

});

1 Comment

It is actually flashembed() as I have found flowplayer.org/demos/installation/alternate/index.html Thanks for the contribution though

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.