lundi 2 février 2015

Playing embedded SoundCloud player at timecode on site


Vote count:

0




I'm trying to use the SoundCloud API to control an embedded player on my site. I'm hoping to do two things: 1) Load a starting timecode via a querystring and 2) Have the player autoplay, after the page loads, at the specified timecode.


Loading in the starting timecode via querystring is easy enough, and I can get the player to start at a specific timecode. But it won't autoplay. I CANNOT get the player to autoplay on page load no matter what I do. If I hit play, it starts at the right spot, but not on its own.


Here's what I have, code-wise. I've got a DIV around my iFrame with a "sv-audio" class, and I've named the iFrame "sc-widget":



<?php
$t = $_GET["t"];
if ($t != NULL){
echo "<script type=\"text/javascript\">;\r\n";
echo "jQuery(document).ready(function (\$){\r\n";
echo "var player = SC.Widget(\$('.sv-audio iframe').get(0));\r\n";
echo "player.bind(SC.Widget.Events.PLAY, function(ev) {\r\n";
echo "player.seekTo($t);\r\n";
echo "});\r\n";
echo "player.play();\r\n";
echo "});\r\n";
echo "</script>";
}
?>


Any help would be greatly appreciated. Thanks in advance!



asked 17 secs ago







Playing embedded SoundCloud player at timecode on site

Aucun commentaire:

Enregistrer un commentaire