Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Captcha > Radcaptcha audio not working in Safari

Not answered Radcaptcha audio not working in Safari

Feed from this thread
  • Pradeep avatar

    Posted on Nov 1, 2011 (permalink)

    I am using .wav files to generate the audio. It works in all the popular browsers except Safari. I am using the latest version of safri and also have quicktime installed too but still it didn't work. Have anyone faced this issue earlier .  Can anyone help with this issue.

    Reply

  • Posted on Nov 2, 2011 (permalink)

    Hello Pradeep,

    Take a look at the following forum thread.
    Captcha audio not working in MAC os.

    Thanks,
    Princy.

    Reply

  • Pradeep avatar

    Posted on Nov 7, 2011 (permalink)

    Thanks for the reply Princy. But it not specific to MAC. even Windows version of Safari doesn't play the audio. I have to use the wav files to render the audio. According to the thread, since latest version of Safari supports html 5, it should be able to play those wav files but unfortunately I couldn't make it work.

    Should I have to do anything specific to Safari to make it work ?

    Reply

  • Slav Slav admin's avatar

    Posted on Nov 9, 2011 (permalink)

    Hello Pradeep,

    Please ensure that you have properly installed the QuickTime plugin as it is required to play the .wav files of the RadCaptcha under the Safari browser.

    You can check if the problem is reproducible in the online demo Captcha Audio Code and if not, please send us a sample runnable page that isolates the problem so that we can inspect it locally and pinpoint the cause.

    Regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

  • David avatar

    Posted on Jan 23, 2012 (permalink)

    test.
    sorry, it was a mistake.

    Reply

  • Posted on Mar 26, 2012 (permalink)

    I did enter a support ticket but...

    The Demo RadCaptcha page's audio won't play on an Iphone and apparently also an Ipad.

    Reply

  • Pero Pero admin's avatar

    Posted on Mar 27, 2012 (permalink)

    Hi Paul,

    The iPhone and iPad use the same browser, mobile Safari. The RadCaptcha audio code cannot be played under mobile Safari, because the browser doesn't support <embed/> and the HTML5 <audio/> tags.
    You could force download of the audio file when the user clicks to play the audio, if the browser does not support these tags. This can be done with the following custom JavaScript code. Please paste it below your ScriptManager control on the page where the RadCaptcha resides:

    <script type="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)
            {
                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"
                if (navigator.plugins)
                {
                    for (i = 0; i < navigator.plugins.length; i++)
                    {
                        if (navigator.plugins[i].name.indexOf("QuickTime") >= 0)
                        {
                            isInstalled = true;
                        }
                    }
                }
      
            }
            return isInstalled;
        }
    </script>


    All the best,
    Pero
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Captcha > Radcaptcha audio not working in Safari