Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Embedding/inserting flv files / using insert flash object


Go to End


8 Posts   8903 Views

Avatar
africansafari

Community Member, 30 Posts

2 December 2009 at 9:24am

Hi folks,

I have looked through various threads to find out how to embed/install a .flv file on website.

I have uploaded and can't see .flv via 'insert flash object' .... so thought I would embed using the following html .... I have adjusted domain name, video name etc

<div id="v1234">
<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this video.
</div>
<script type="text/javascript" src="https://media.hosting.com/mp4/swfobject.js"></script>
<script type="text/javascript">
var swf = new SWFObject("https://media.hosting.com/mp4/player.swf", "mpl", "720", "596", 8); swf.addParam("allowfullscreen", "true"); swf.addParam("allowscriptaccess", "always"); swf.addVariable("file", "http://www.mydomain.com/videos/video.flv");
swf.addVariable("image", "http://www.mydomain.com/videos/video.jpeg");
swf.write("v1234");
</script>

However .... no .flv file plays.

I just can't seem to work it out??? This should be easy, right?

Maybe I am missing a very basic step?

Any assistance would be great!

Claire

Avatar
Double-A-Ron

Community Member, 607 Posts

2 December 2009 at 2:28pm

Hi Claire

Where are you putting this code? In a template or in the CMS editor?

Can you see the correct source code when you view source on your front end page?

Aaron

Avatar
africansafari

Community Member, 30 Posts

2 December 2009 at 3:10pm

Thanks for the quick reply Arran. I am placing code in the "edit html content" within the content editor.

When I save, view and then return to html content .... it seems to have disappeared.

Does that give any more clues?

Cheers

Claire

Avatar
Double-A-Ron

Community Member, 607 Posts

2 December 2009 at 3:21pm

Yup,

You can't do that. Not by default anyway. TinyMCE (the editor) is setup to strip certain tags for securtiy reasons.

You can amend this yourself, but you will need to get into the core files to change the the way Tiny is setup.

More details can be found here. This person is not installing flash, but the same issue with the same work around is there.

http://www.silverstripe.org/general-questions/show/274442?start=0#post274530#post274530

Aaron

Avatar
africansafari

Community Member, 30 Posts

2 December 2009 at 4:17pm

Thanks Aaron. Looks more complicated that I want :-(

How come it is possible to imbed youtube and other hosted videos using HTML in TinyMCE?

Cheers

Claire

Avatar
Double-A-Ron

Community Member, 607 Posts

2 December 2009 at 4:52pm

Edited: 02/12/2009 4:54pm

Hi Claire,

Because Youtube doesn't use javascript in their embed code like you have posted. They use the object tag.

Try paste yours in the CMS again, then re-open the html window. You will notice that the <div> and everything in between is still there, but everything in the script tags (and the script tags themselves) has been stripped out by TinyMCE.

Object tags aren't that bad security-wise. Javascript on the other hand can be nasty in the wrong hands.

You could of course put your flv into traditional object tags the way Youtube does. Here is an example embed:

<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/-YqpTirruKY&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-YqpTirruKY&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>

Aaron

Avatar
bummzack

Community Member, 904 Posts

2 December 2009 at 9:01pm

Hi

Embedding content like this just calls for problems. JavaScript doesn't belong in the content area at all. It should be applied as an unobtrusive "layer" on top of your content. Embedding flash like Aaron proposed might work, but is really cumbersome and error prone.
There are multiple solutions to this though. If the embeddable content really needs to be inside the content-text, I'd probably use some sort of placeholder variable and replace it with the correct embed code during parsing. This recipe could be a good starting point:
http://doc.silverstripe.org/doku.php?id=recipes:customising-content-in-your-templates

If you're not uncomfortable writing some regex for parsing, you could even do something like $YouTube(oHg5SJYRHA0), which would then be parsed and correctly embed the video at: http://www.youtube.com/watch?v=oHg5SJYRHA0

The things get a whole lot easier if you separate your movie from the text content though. A really simple approach would be to add an additional TextArea field to add embed codes in plain text. Or something like described here: http://silverstripe.org/general-questions/show/273828?start=0#post274276
The solution provided in this thread could easily be extended to allow for a video (flv) and image upload (as starting image in the player and as alternative content).

Avatar
Double-A-Ron

Community Member, 607 Posts

2 December 2009 at 9:16pm

Banal's suggestion is exactly how I would do it and do. The question of allowing advanced HTML into Tiny comes up alot on on these forums (three times in the last week) and generally the people wanting to do so have reasons of their own, or are not advanced enough to quickly get what they need in a timeframe that may be urgent, and in a scalable way. So this work-around is provided and always has been (Not just for this CMS).

Banal's suggestion is by far the safest and more structured approach for anything like this. If you are willing to get into coding for Silverstripe (which will only help you), then I suggest you heed his advice and links he provided.

Aaron