Skip to content

Instantly share code, notes, and snippets.

@will-in-wi
Created January 21, 2014 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save will-in-wi/8542803 to your computer and use it in GitHub Desktop.
Save will-in-wi/8542803 to your computer and use it in GitHub Desktop.
A test for starting at the right position on initial playback.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test time to duration</title>
<meta name="viewport" content="width=device-width, user-scalable=no" />
<script src="script/soundmanager2.js"></script>
<script type="text/javascript">
"use strict";
soundManager.setup({
url: 'swf/',
flashVersion: 9, // optional: shiny features (default = 8)
// optional: ignore Flash where possible, use 100% HTML5 mode
preferFlash: false,
onready: function() {
console.log('ready!!!');
var sound = soundManager.createSound({
id: 'testSound',
url: 'http://ondemand-http.stream.publicradio.org/minnesota/general/performances/2008/08/08/test13_20080808_64.mp3',
position: 10000
});
var start_link = document.querySelectorAll(".start")[0];
start_link.addEventListener('click', function(e){
e.preventDefault();
sound.play();
});
}
});
</script>
</head>
<body>
<a style="margin: 20px; display: block; border: 1px solid black; padding: 20px;" href="#" class="start">Start test</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment