Captcha autoplays audio when the page loads

2 posts, 0 answers
  1. Paul Duncan
    Paul Duncan avatar
    6 posts
    Member since:
    Sep 2007

    Posted 15 Oct 2010 Link to this post

    Captcha autoplays audio when the page loads.  Is there anyway to stop this? We'd like the audio to only play when they click the link.. 

    You can see/hear the behavior here:
    http://demos.telerik.com/aspnet-ajax/captcha/examples/captchaaudiocode/defaultcs.aspx

    Thanks,
    Paul
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 18 Oct 2010 Link to this post

    Hi Paul,

    By design the RadCaptcha will try playing the audio code using <audio/> html5 element. Since not all browsers support <audio/> tag, as a backup variant the code is played using the <embed/> tag, which requires the browser to install QuickTime plug-in. So, in case the plug-in is configured to play the media file immediately after the page is loaded, the audio code will be played immediately.

    To avoid this try setting autoplay attribute of the <embed/> tag to false, as shown in the following code:

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            function pageLoad(application, args)
            {
                var captcha = $find("RadCaptcha1");
                var objectElement = captcha._objectElement;
                objectElement.setAttribute("autoplay", "false");
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="ScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div>
            <telerik:RadCaptcha ID="RadCaptcha1" runat="server" ErrorMessage="Invalid Code" ValidationGroup="Group"
                ForeColor="Red" CaptchaImage-EnableCaptchaAudio="true">
            </telerik:RadCaptcha>
            <asp:Button ID="Button1" runat="server" Text="Validate Code" ValidationGroup="Group" />
        </div>
        </form>
    </body>
    </html>


    All the best,
    Pero
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top