Permalink
Browse files

Hide play button and show loading message if audio is not finished pr…

…ocessing on the server. Fixes #147.
  • Loading branch information...
1 parent 419ff54 commit 12abc7cbe309265ce2668ce4e23401f789b1a557 @jeresig jeresig committed May 9, 2012
Showing with 22 additions and 0 deletions.
  1. +12 −0 css/style.css
  2. +10 −0 js/play-ui.js
View
@@ -923,6 +923,18 @@ div#exercise-page {
display: block;
}
+#play-page.scratch .loading-msg {
+ line-height: 30px;
+}
+
+#play-page.scratch .loading {
+ width: 20px;
+ height: 20px;
+ display: inline-block;
+ vertical-align: middle;
+ margin: -3px 3px 0 3px;
+}
+
/* Handle playback styling */
html.playing #editor textarea {
display: none;
View
@@ -531,6 +531,15 @@ var seekTo = function( time, noUpdate ) {
var audioInit = function() {
var wasPlaying;
+ // An empty track means that the server is still processing the audio
+ if ( track.duration === 0 ) {
+ $("#playbar")
+ .show()
+ .html( "<span class='loading-msg'>Audio is processing, reload page in a minute." +
+ "<span class='ui-icon loading'></span></span>" );
+ return;
+ }
+
var updateTimeLeft = function( time ) {
$("#timeleft").text( "-" + formatTime( (track.duration / 1000) - time ) );
};
@@ -540,6 +549,7 @@ var audioInit = function() {
Record.time = 0;
updateTimeLeft( 0 );
+
player = SC.stream( Exercise.audio_id.toString(), {
autoLoad: true,

0 comments on commit 12abc7c

Please sign in to comment.