Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stefan 39 posts 70 karma points
    Feb 18, 2015 @ 15:09
    Stefan
    0

    HTML 5 Audio Macro

    This is the code I have that has been converted to be used with umbraco 7 but it dosetn work . Can anyone help?

    I keep getting this error : Error loading Partial View script (file: ~/Views/MacroPartials/InsertAudio.cshtml)

     

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

     

    @{

        var mp3Id = Model.MacroParameters["mp3"].ToString();

        var mp3 = Umbraco.TypedMedia(mp3Id);

        var mp3Url = mp3 != null ? mp3.Url : string.Empty;

        var controlsTog = string.Empty;

        if (string.Equals(Model.MacroParameters["controls"].ToString(), "1"))

        {

            controlsTog = "controls";

        }

    }

     

    @if (!string.IsNullOrEmpty(mp3Url))

    {

        <audio @controlsTog>

            <source src="@mp3Url" type="audio/mpeg" />

            Your browser does not support the audio tag.

        </audio>

    }

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 18, 2015 @ 15:29
    Jan Skovgaard
    0

    Hi Stefan and welcome to our :)

    Could you have a look in the /App_Data/Logs file and see if it reveals a more detailed description of the error? It should be marked with "ERROR".

    /Jan

  • Stefan 39 posts 70 karma points
    Feb 18, 2015 @ 15:31
    Stefan
    1

    Got it working . Turns out i didnt have the right macro parameter aliases.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 18, 2015 @ 15:47
    Jan Skovgaard
    0

    Hi Stefan

    Ok, happy to hear that :) - But if you're stuck with an issue like this later on then keep in mind that you can get some more detailed information by having a look in the log files :)

    Happy coding.

    /Jan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 18, 2015 @ 15:47
    Dennis Aaen
    0

    Hi Stefan and welcome to our.,

    Have you added the parameters to the marco. It should look something like this:

    The important part is the alias of the marcos params is matching your code, in your case controls and mp3. When you inserted the macro you will need to pick a file and a content node in my example. When you have done this. The code for the macro that you have inserted should look something like this.

    @Umbraco.RenderMacro("Audio html5", new {controls="1068", mp3="1078"})

    The name Audio html5 is my name of the partial view macro

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft