This is a migrated thread and some comments may be shown as answers.

Captcha autoplays audio when the page loads

1 Answer 51 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Paul Duncan
Top achievements
Rank 1
Paul Duncan asked on 15 Oct 2010, 07:58 PM
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

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 18 Oct 2010, 05:01 PM
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
Tags
Captcha
Asked by
Paul Duncan
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or