No CAPTCHA Audio in IE 8

4 posts, 0 answers
  1. John
    John avatar
    31 posts
    Member since:
    May 2011

    Posted 05 Aug 2011 Link to this post

    I cannot hear any CAPTCHA audio in IE8 (for Windows 7), although it works fine in Firefox on the same computer. I have tried multiple computers (all similar configuration) in our office and all have the same issue.

    This applies to my own code as well as the sample on demos.telerik.com.

    I have the Quicktime add-in installed and enabled for all sites, but do not have Quicktime Player installed.

    There is no error, just no sound.

    What is required for audio to work and if Quicktime is not installed should it not prompt to install the add-in or revert to the WAV files?
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 08 Aug 2011 Link to this post

    Hi John,

    The browsers IE6, IE7 and IE8 cannot play an audio file directly without an external plugin. In newer browsers that support HTML5 <audio/> the file can be played directly without the need to install additional software.

    In order to be able to play the sounds without additional plugins installed, I would recommend changing the code a bit so that the file is downloaded in the browser. Please add the provided code below your ScriptManager control, on the page containing the RadCaptcha:

    <scripttype="text/javascript">
        Telerik.Web.UI.RadCaptcha.prototype._createAudioElements = function ()
        {
            var audioUrl = this.get_audioUrl();
            var audioLink = this.get_audioLink();
      
            $addHandlers(audioLink, { "click": this.onAudioPlay }, this);
      
            var element = audioLink.parentNode;
            this._audioElement = this._createAudioElement(audioUrl);
            element.appendChild(this._audioElement);
      
            // Opera 10, Safari 4 and Firefox 3.5 support WAV, but Chrome 3 doesn't.
            // IE6,7 and 8 do not support <audio/>
            var doesNotSupportAudio = (!this._supportsAudio() || (this._audioElement && this._audioElement.canPlayType && !this._audioElement.canPlayType("audio/wav")));
            if (doesNotSupportAudio)
            {
                alert("check");
                var _qtInstalled = IsQTInstalled();
                if (_qtInstalled)
                {
                    this._objectElement = this._createObjectElement(audioUrl);
                    element.appendChild(this._objectElement);
                }
                else
                {
                    this.downloadFile = true;
                }
            }
            else
            {
                audioLink.setAttribute('href', "#");
            }
        }
        Telerik.Web.UI.RadCaptcha.prototype.onAudioPlay = function (e)
        {
            if (this._objectElement)
            {
                this._objectElement.Play();
            }
            else if (this._audioElement && this._audioElement.play)
            {
                //Chrome supports <audio/>, but the audio is played only once. That's why we need
                //to load the audio file explicitly
                if ($telerik.isChrome)
                {
                    this._audioElement.load();
                }
                this._audioElement.play();
            }
      
            if (!this.downloadFile)
            {
                return $telerik.cancelRawEvent(e);
            }
        }
      
        function IsQTInstalled()
        {
            var isInstalled = false;
            var qtVersion = null;
            if (window.ActiveXObject)
            {
                var control = null;
                try
                {
                    control = new ActiveXObject('QuickTime.QuickTime');
                }
                catch (e)
                {
                    // Do nothing
                }
      
                if (control)
                {
                    // In case QuickTimeCheckObject.QuickTimeCheck does not exist
                    isInstalled = true;
                }
      
                try
                {
                    // This generates a user prompt in Internet Explorer 7
                    control = new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck');
                }
                catch (e)
                {
                    return isInstalled;
                }
      
                if (control)
                {
                    // In case QuickTime.QuickTime does not exist
                    isInstalled = true;
      
                    // Get version
                    qtVersion = control.QuickTimeVersion.toString(16); // Convert to hex
                    qtVersion = qtVersion.substring(0, 1) + '.' + qtVersion.substring(1, 3);
                    qtVersion = parseFloat(qtVersion);
                }
            }
            else
            {
                // Check navigator.plugins for "QuickTime Plug-in"
            }
            return isInstalled;
        }
    </script>


    Greetings,
    Slav
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    31 posts
    Member since:
    May 2011

    Posted 08 Aug 2011 Link to this post

    The script made no difference, still no audio. Although it did pop up with an alert box saying "check".

    Can I ask why this sort of thing is not included by default with the control?
  5. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 11 Aug 2011 Link to this post

    Hi John,

    You can find attached my demonstration project. Please compare it with your actual project and check if there are differences in the setup. In case you the functionality works as expected on your end, you may use the sample as a base for your further development.

    As for playing the RadCapthca's audio under browsers that don't support the audio tag or don't have additional plugins (QuickTime plugin), the feature has been logged into PITS and can be examined by following the link: Public URL. We will consider implementing the discussed feature in a future release of the RadControls for ASP.NET AJAX, if demand for it is high enough.

    Kind regards,
    Slav
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top