Embedding code into a branch page.

Embedding code into a branch page.

Larry Hart - દ્વારા
Number of replies: 14
Hi, I need to embed some code into a branch page and/or question page.

The code is similar to this...

<embed src="http://xxx.xx.amazonaws.com/player/mediaplayer46.swf"
width="600" height="448"
allowscriptaccess="always" allowfullscreen="true"
flashvars="autostart=false&type=rtmp&streamer=rtmp://s1qrmz7k3mgncz.cloudfront.net/cfx/st&abouttext=xxx&aboutlink=http://www.xxx.xx/about/index.cfm?memref=xxxxxxxxx&skin=http://xxx.xx.amazonaws.com/player/Snel2.swf&controlbar=over&stretching=exactfit&allowfullscreen=true&wmode=opaque&file=hs003.flv&width=600&height=448&screencolor=000000&bufferlength=10&volume=80&showicons=true" />

(I have changed the code slightly for privacy but I hope you get the idea). It is code for a streaming video I want to show.

Trouble is, when I paste it into the editor it either does NOT display correctly on the preview or moodle re-writes it and messes it up. I have played with the Modual Filters but this doesn't seem to make any difference.

Please help anyone?

Regards

Larry

In reply to Larry Hart

Re: Embedding code into a branch page.

Joseph Rézeau - દ્વારા
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Larry,

The question of embedding videos into moodle activities is not directly related to the Lesson module. There is normally no problem embedding videos, provided of course that admin has authorized it in Administration ► Security ► Site policies :: Allow EMBED and OBJECT tags.

Are you able to embed your video in the HTML editor in other activities than Lesson on your moodle site?

Joseph

PS.- It might help if you provided a complete real example of the kind of video you want to embed.

In reply to Joseph Rézeau

Re: Embedding code into a branch page.

Larry Hart - દ્વારા
Thanks Joseph, I have enabled the Embed and Object Tags in Security but it makes no difference.

On a branch page it seems that Moodle is trying to insert its own player and thus fails to work...

error1.jpg

On the other hand... in a webpage I added it works ok...

error2.jpg

The actual code I want to add to a branch page is as follows....

<embed src="http://ezs3.s3.amazonaws.com/player/mediaplayer46.swf"
width="600" height="448"
allowscriptaccess="always" allowfullscreen="true"
flashvars="autostart=false&type=rtmp&streamer=rtmp://s1qrmz7k3mgncz.cloudfront.net/cfx/st&abouttext=eZs3&aboutlink=http://www.ezs3.com/about/index.cfm?memref=Lazersam&skin=http://ezs3.s3.amazonaws.com/player/Snel2.swf&controlbar=over&stretching=exactfit&allowfullscreen=true&wmode=opaque&file=hs003.flv&width=600&height=448&screencolor=000000&bufferlength=10&volume=80&showicons=true" />


In reply to Larry Hart

Re: Embedding code into a branch page.

Lynn Scarlet Clark - દ્વારા
Dear Larry - the phrase you used about Moodle messing things up gives me a hint on what may be causing this. You should be entering any script (other than html) into Moodle with the HTML editor turned off, otherwise Moodle puts in symbols to render the code inoperable, just in case it conflicts with its own code within the page.

To do this, go to your own edit profile page (click on the instance of your name) and make sure Show Advanced is on. Scroll down until you see the field 'When editing text' and make sure 'use standard web forms' is showing against it. Save your profile.

Clearly, you can turn the HTML back on by reversing this process once you've saved your branch page.

Remember that you must turn off HTML when editing ANY part of a page, block or topic that has non-HTML code in it. Just because you're not editing the piece of code itself, Moodle will still shove in symbols when you save the page.

I hope this is the solution you're looking for!
In reply to Lynn Scarlet Clark

Re: Embedding code into a branch page.

Joseph Rézeau - દ્વારા
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Unfortunately, Scarlet, this is not the solution to the problem that Larry is experiencing.

I can confirm Larry's finding that there is something wrong in the way that the Lesson module displays (or rather does not display) some swf + flv video files.

I will try to look into the matter and keep you posted here.

Joseph

In reply to Joseph Rézeau

Re: Embedding code into a branch page.

Lynn Scarlet Clark - દ્વારા
Ok, sorry for trying to help. I'm sure this is wrong too, but have you tried the advanced flv player? We had problems with streaming flvs showing correctly in lessons before we employed this.

Will shut up now...
In reply to Lynn Scarlet Clark

Re: Embedding code into a branch page.

Joseph Rézeau - દ્વારા
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
The problem seems linked to the Lesson module, since I confirm Larry's finding that his video displays fine using the HTML editor in other Moodle modules.
In reply to Joseph Rézeau

Re: Embedding code into a branch page.

Joseph Rézeau - દ્વારા
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Got it.cool

If you are willing to hack your core Moodle code, using latest moodle 1.9.9 in file moodle/mod/lesson/view.php, around line 540, change the format in red to format in blue

print_simple_box('<div class="contents">'.
format_text($page->contents, FORMAT_MOODLE, $options).
'</div>', 'center');

change to:

print_simple_box('<div class="contents">'.
format_text($page->contents, FORMAT_HTML, $options).
'</div>', 'center');

See attached result,

Joseph

PS.- Please note that the code of the Lesson module has not been maintained for quite some time now. Hopefully things will get better in Moodle 2.1 (not 2.0).

Attachment image00.jpg
In reply to Lynn Scarlet Clark

Re: Embedding code into a branch page.

Chris Collman - દ્વારા
Picture of Documentation writers
Scarlet,
Trying to help is always permissible!

Even if you offer an off the mark cure, it might help somebody else with a solution to their problem. The brain, the search engine and context all work in strange and mysterious ways.

I have made more than 1 "wrong" suggestion, as many can attest. If you read some of my posts you can see my qualifications like: "I do not deal with code much but I wonder if...." My attitude is that we learn by doing: try to duplicate the issue, I watch what happens after the injection of my idea/comment (usually long, so unlike my terse edits in MoodleDocs સ્મીત ), learn, and try to be gracious to all.

Just remember that grace can be defined both in the eye of the receiver and in the eye of the giver.

Keep those comment coming.

Chris
In reply to Chris Collman

Re: Embedding code into a branch page.

Lynn Scarlet Clark - દ્વારા
Thanks very much Chris for your supportive comments!
In reply to Lynn Scarlet Clark

Re: Embedding code into a branch page.

Joseph Rézeau - દ્વારા
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Chris and Scarlet,

Thanks for your help (Scarlet) and encouraging comments (Chris). Help is always welcome in these forums, and two (or more) heads are better than one.wink

Now we'll have to wait for the OP's reply*, hoping that we have finally solved his problem.

Joseph

*OP = Original Poster

In reply to Joseph Rézeau

Re: Embedding code into a branch page.

Larry Hart - દ્વારા
Thanks everyone! Scarlet Your suggestion seemed very logical to me and I tried it - unfortunately I had the same result as before.

I changed the code as Joseph suggested and this seems to have worked! The player is working on the Lesson Branch page (so far).

I really appreciate your help guys big grin
In reply to Larry Hart

Re: Embedding code into a branch page.

Chris Collman - દ્વારા
Picture of Documentation writers

Just a thanks to both Larry and Joseph.   My admin just tasked me with getting Flash to work in 1.9.9 in a Lesson.  When I get to work tomorrow,  I will charge the code in a localhost (just to make sure I got it right) and then in our production site .

Sounds to me as if the "Moode_format" has carried forward from 1.4 સ્મીત

Chris

 

In reply to Joseph Rézeau

How to Embed quiz into a branch page.

lavanya mohan - દ્વારા

Hi,

How to include quiz inside the lesson of branch page?