embedding audio in html - ie and firefox using php - php

I'm trying to create an audio captcha system for the visually impaired. I have a system that will glue several wave files together, but I'm having trouble embedding them in ie and firefox.
<script type="text/javascript">
function EvalSound(soundobj)
{
var thissound=document.getElementById(soundobj);
thissound.Play();
}
</script>
<embed src="createaudiocaptcha.php?x=46765" autostart="false" width="0" height="0" id="sound1" enablejavascript="true">
<img src="gfx/speaker.gif" border="0" alt="Audio capture for visually impaired">
using this works, however ie (vista) will just play the sound straight away, it should wait until the speaker has been clicked. IE on win xp seems to lock up for some reason.
I have tried changing the embed for this:
<object type="application/x-mplayer2" height="0" width="0" id="sound1">
<param name="src" value="createaudiocaptcha.php?x=19329">
<param name="autostart" value="0">
<param name="playcount" value="1">
</object>
however ie on winxp still sems to lock up - ie on vista plays the sound straight away and firefox will not play it saying no play() function.
does anybody know why ie on windows xp would lock up? -
Suggestion appreciated

There's an audio service that essentially does this exact thing called ReCaptcha (http://recaptcha.net/).
You can read a review of the service on ReadWriteWeb if you would like to know more about it.
Google also offers an audio captcha. There's an article on the official Google blog here.

I am doing the SAME thing as you with the SAME script. My IE begged me to install the plugin for Media Player. Once I clicked the ActiveX bar at the top if IE to install it... no more locking up. Check your Security Options in IE and/or update Java to the latest and greatest. For what it's worth... I did get mine working on IE and FF with 5 different sounds once the plugin was installed. Oh... and I put around the lines.... one in front and the /object at the end. Maybe that will help you??!?

Scriptaculos has a pretty good Sound library. You can play and stop with it; it should fulfill your needs.

Why not only embed the audio file as needed. Write the embed/object tag out with JavaScript only when someone has clicked "I need the audio captcha"
put some tags on the page like:
Please play the audio Captcha<br />
<div id="audioCaptcha">
</div>
Then the getMeTheAudio() function fills in the innerHTML of the audioCaptcha div with the embed/object. You could sniff the browser type if you want to be fancy.

You will find multiple possible options in the link below ,
http://www.phon.ucl.ac.uk/home/mark/audio/play.htm#

Related

iframe php injection into my html site

I have quite a small website, with a total of 3 webpages, consisting of only html, css and jquery...now on one of my .html pages, I have this annoying iframe injection (the source file is php) that is added on top of my body tag each time i load my page. Now I deleted all my referenced stylesheets, plugins etc one by one but the only way get rid of it is if I delete all my content for that page. How do I get rid of this iframe? Any tips?
Note that the same plugins I used on my other pages I used on this 'hacked page', except for one plugin...but removing that one plugin does not fix it...?
Here is the iframe code I got by inspecting the element: this whole part below is injected
<div style="padding-left: 120px;">
<iframe width="728" scrolling="no" height="90" frameborder="0" allowtransparency="yes" src="http://b.admedia.com/banner.php?id=18793&sr=1&injection_code=true&subid=FC&ip=[IP]&ua=[UA]&transparency=[TR]&highlight=0&style=1&appnxsId=860932&size=728x90&search=digital cameras&force=1&ref=&bpage=">
<html>
<head>
</head>
<body>
</body>
</html>
</iframe>
</div>
You almost certainly have malware on your PC.
For example, see this and this. Most likely you have a trojan that is injecting the code into explorer, enabling the attacker to farm for ad clicks.
You can confirm by trying a different browser or running a virus/malware scanner.

How we can play audio in html page

In my page i have a button called Play
In included windows media player using this tag
<embed id="wmpid" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="mediaplayer1" ShowStatusBar="false" EnableContextMenu="false" autostart="0" width="200" height="45" loop="false" src="/1.wma" />
The audio is starting when i click on the play contoller.
But when i click on the play button, that i created ,how i can play the audio
Thanks in advance
You have to use JavaScript to play the sound by clicking on a button.
<script>
function EvalSound(soundobj) {
var thissound= eval("document."+soundobj);
thissound.Play();
}
</script>
<embed src="success.wav" autostart=false width=0 height=0 name="sound1"
enablejavascript="true">
Here are examples of a link, an image and a button calling the function.
Click here
You need to handle events via JavaScript. Refer is-there-a-documented-javascript-api-for-windows-media-player
Personally I recommend Yahoo Media Player. Windows Media Player might not work on all platforms. Prefer a flash based player. You might need to convert wma to mp3.

How to I check to see if the browser supports flash?

I have a flash banner that I want to replace with a static image if the clients browser doesn't have flash enabled.
I was wondering if I can do this with php - or if anyone knows of a good method
Thanks
Allow the <object> (your Flash movie) to degrade:
<object width="640" height="480">
<param name="movie" value="yourflash.swf">
<img src="yourimage.png">
</object>
This will show the image if the Flash video can't load, too.
You can only do this with javascript, using the navigator.plugins interface. Something like:
if(typeof navigator.plugins['Shockwave Flash']!=='undefined'){ }
However, a far more reliable solution that doesn't require any javascript would be simply to position your fallback image "behind" the flash object so that if the flash doesn't turn up, the image will show through. You can either put an <img/> tag inside the flash <object/> or you can put a CSS background-image on the object.
http://code.google.com/p/swfobject/
This is what I use when i need to embed flash and it checks for relavent support and what elements are needed.
I don't think you can check with PHP, you can do it with javascript or Actionscript from SWF file. Here is the official detection kit:
http://www.adobe.com/products/flashplayer/download/detection_kit/
You could use SWFobject
With SWFobject you display alternative code by default, e.g.
<div id="myContent">
<p>Alternative content</p>
</div>
This is then replaced where possible with flash content like this:
<script type="text/javascript">
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>
It does have a dependency on JavaScript though which is its only major drawback

XSPF Web Music Player and restarting music in surfing

I asked a question in this link;
Streaming music background
function music(){
$txt = '<object type="application/x-shockwave-flash"
data="http://***.com/slim.swf?&autoplay=true&repeat=true&shuffle=true&song_url=http: //***.com/music.mp3&"
width="200" height="20">
<param name="movie"
value="http://***.com/slim.swf?&autoplay=true&repeat=true&shuffle=true& song_url=http://***.com/music.mp3&" />
<img src="noflash.gif"
width="0" height="0" alt="" />
</object>';
echo $txt;
}
I have added this player with a simple php fonction. The player is working perfect but when page changes, the music restarts. I want that I will be continued.
What is wrong in code?
Update: Ah, so you are in fact using a player with an autoresume function. Well, then turn on the autoresume, will ya?
By default, autoresume is off. To turn it on, you need to add &autoresume=1 to the end of the player URL, as shown here: [...]
Old answer:
I'm afraid I think you got this wrong. The answerer in the other question was talking about creating a whole site in Flash, something that would enable you to have continuous background music.
It's not easy to get continuous music on a HTML page. Check out this question for some pointers.

How can I insert links into swf files using PHP?

I am trying to insert links into a swf banner(on all its surface) automatically using php. I am almost sure I saw this feature in OpenAds...
Sorry, but this can't be done apart from having a click-handler in the SWF that takes the location target of the click as a parameter, in which case the parameter is given to the Flash-file on html-level.
Eg
<object>
<param name="movie" value="YOURFLASH.swf" />
<param name="flashVars" value="clickTag=http%3A//www.example.com/&clickTAG=http%3A//www.example.com/&clicktag=http%3A//www.example.com/&clickTag2=http%3A//www.example.com/" />
<embed src="YOURFLASH.swf" flashvars="clickTag=http%3A//www.example.com/&clickTAG=http%3A//www.example.com/&clicktag=http%3A//www.example.com/&clickTag2=http%3A//www.example.com/"></embed>
</object>
The parameter name clicktag (in different case-variants) is a common parameter name for setting a click-handler in banners.
You can try to place a div over a flash clip in html and put your links there. This requires very careful positioning and may look weird.
Assuming you have access to the flash source you could load the links from a resource generated with PHP (or any server side tech) from within the flash.
Then your links are generated as xml/json/html and the flash displays them.
google flash loading data for a bunch of different tutorials and articles.

Categories