Skip to content

Instantly share code, notes, and snippets.

@benbai123
Created June 27, 2012 09:42
Show Gist options
  • Save benbai123/3003008 to your computer and use it in GitHub Desktop.
Save benbai123/3003008 to your computer and use it in GitHub Desktop.
Play HTML5 audio in ZK
<zk xmlns:h="xhtml">
<window border="normal">
<h:audio id="audio" src="test.mp3" controls="controls"
preload="auto" autoplay="autoplay">
Your browser does not support the audio element.
</h:audio>
<button label="Play">
<attribute name="onClick">
Clients.evalJavaScript("jq('$audio')[0].play()");
</attribute>
</button>
<button label="Stop">
<attribute name="onClick">
Clients.evalJavaScript("jq('$audio')[0].pause()");
</attribute>
</button>
</window>
</zk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment