Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [Solved] Upload movies via backend

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

Page: 1
Go to End
Author Topic: 364 Views
  • StefanDpunkt
    Avatar
    Community Member
    14 Posts

    [Solved] Upload movies via backend Link to this post

    Hi,

    I want to upload movies via backend.
    The films are of type "file"

    public static $ has_one = array (
    "mp4" => "File"
    "m4v" => "File"
    "ogv" => "File"
    "webm" => "File"
    );
    [/ code]
    Unfortunately, I get the following error!

    [User Error] Uncaught Exception: Object-> __call (): the method 'fortemplate' does not exist on the 'File'
    [/ code]
    I can not do anything with this error message, so, anyone has an idea?

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: [Solved] Upload movies via backend Link to this post

    Can you provide some more info, where are you getting this error? When uplaoding files, or trying to display them in the fornt end?

  • StefanDpunkt
    Avatar
    Community Member
    14 Posts

    Re: [Solved] Upload movies via backend Link to this post

    Hallo zenmonkey,

    i get this error in the front end, in the back end, i get no error. Uploading without errors.

    Code Front end

    <% loop Movies %>
    <div id="clip0" class="easyhtml5video" style="position:relative;max-width:640px;">
    <video id="video0" autoplay="autoplay" poster="$Startbild.Filename" style="width:100%" title="" loop="loop" onended="var v=this;setTimeout(function(){v.play()},300)">
    <source src="$webm" type="video/webm" />
    <source src="$mp4" />
    <source src="$ogv" type="video/ogg" />
    <source src="$m4v" type="video/mp4" />
    <object type="application/x-shockwave-flash" data="$Startbild.Filename" width="640" height="480" style="position:relative;">
    <param name="movie" value="../flashfox.swf" />
    <param name="allowFullScreen" value="true" />
    <param name="flashVars" value="autoplay=true&amp;controls=false&amp;fullScreenEnabled=false&amp;posterOnEnd=true&amp;loop=true&amp;poster=$Startbild.Filename&amp;src=$m4v" />
    <embed src="..flashfox.swf" width="640" height="480" style="position:relative;" flashVars="autoplay=true&amp;controls=false&amp;fullScreenEnabled=false&amp;posterOnEnd=true&amp;loop=true&amp;poster=$Startbild.Filename&amp;src=$m4v"   allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />
    <img alt="" src="$Startbild.Filename" style="position:absolute;left:0;" width="100%" title="Video playback is not supported by your browser" />
    </object>
    </video>
    </div>
    <% end_loop %>
    [/end]

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: [Solved] Upload movies via backend Link to this post

    Okay as I suspected. $webm, $ogv etc returns the file Object (the whole database record), you want to get a property off it. You'll need to use $webm.Filename. I find if the solution is video.js based you should use $webm.AbsoluteURL otherwise the falsh fallback can fail.

    As an aside I would also wrap each of them in a if statement just in case the end user fails to upload one of them

    <% if $webm %><source src="$webm.AbsoluteURL" type="video/webm" /><% end_if %>

  • StefanDpunkt
    Avatar
    Community Member
    14 Posts

    Re: [Solved] Upload movies via backend Link to this post

    It' s work!
    Many, many, many THX!

    !!!And I still have a bit more understood by SilverStripe!!!

    364 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.