Foros del Web » Programando para Internet » Javascript »

Enlace con sonido y retraso

Estas en el tema de Enlace con sonido y retraso en el foro de Javascript en Foros del Web. Hola, Tengo una pequeña granja de avestruces y estoy haciendo una pagina web con joomla. Tengo una pagina de introduccion en html y java con ...
  #1 (permalink)  
Antiguo 12/02/2012, 09:54
Avatar de ohad  
Fecha de Ingreso: febrero-2008
Ubicación: Campos Del Puerto, Islas Baleares, Spain, Spain
Mensajes: 4
Antigüedad: 16 años, 2 meses
Puntos: 0
Enlace con sonido y retraso

Hola,

Tengo una pequeña granja de avestruces y estoy haciendo una pagina web con joomla. Tengo una pagina de introduccion en html y java con dos imagenes para escojer lengua (www.artestruzmallorca.com)

Quiero que al apretar la imagen suene un archivo .mp3 con el sonido booming del avestruz (booming.mp3) y se retrase en enlace hasta acabar el sonido (3500 ms).

Por ahora tengo esto en el head:
---------------------------------------------------------------------------------------
<head><script>

// Mouseover/ Click sound effect- by JavaScript Kit (www.javascriptkit.com)
// Visit JavaScript Kit at http://www.javascriptkit.com/ for full source code

//** Usage: Instantiate script by calling: var uniquevar=createsoundbite("soundfile1", "fallbackfile2", "fallebacksound3", etc)
//** Call: uniquevar.playclip() to play sound

//code for delayed link

var html5_audiotypes={ //define list of audio file extensions and their associated audio types. Add to it if your specified audio file isn't on this list:
"mp3": "audio/mpeg",
"mp4": "audio/mp4",
"ogg": "audio/ogg",
"wav": "audio/wav"
}

function createsoundbite(sound){
var html5audio=document.createElement('audio')
if (html5audio.canPlayType){ //check support for HTML5 audio
for (var i=0; i<arguments.length; i++){
var sourceel=document.createElement('source')
sourceel.setAttribute('src', arguments[i])
if (arguments[i].match(/\.(\w+)$/i))
sourceel.setAttribute('type', html5_audiotypes[RegExp.$1])
html5audio.appendChild(sourceel)
}
html5audio.load()
html5audio.playclip=function(){
html5audio.pause()
html5audio.currentTime=0
html5audio.play()
}
return html5audio
}
else{
return {playclip:function(){throw new Error("Your browser doesn't support HTML5 audio unfortunately")}}
}
}

//Initialize two sound clips with 1 fallback file each:

var mouseoversound=createsoundbite("booming.mp3", "booming.mp3")
var clicksound=createsoundbite("booming.mp3", "booming.mp3")

</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Artestruz Mallorca</title>
</head>
---------------------------------------------------------------------------------------

y en el body:
---------------------------------------------------------------------------------------
<a href="http://www.artestruzmallorca.com/Joomla/index.php?option=com_content&amp;view=frontpage&am p;setLang=en-GB&amp;Itemid=1"><img src="file:///E|/Proyectos artestruz/webpage/EnglishArtestruz.gif" alt="English Artestruz" width="422" height="500" longdesc="http://www.artestruzmallorca.com/Joomla/" onclick="clicksound.playclip();setTimeout('creates oundbite(sound)', 3500);" /></a>
---------------------------------------------------------------------------------------


Todo parece ir bien, pero el delay nunca se produce...

¿Que puedo hacer?

Muchas gracias de antemano!!

Etiquetas: enlace, html, retraso, sonido
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:10.