* fix IE auth issues (and other browsers)... chehck if session is over between every retry play attempt

This commit is contained in:
Seth Call 2014-03-04 11:56:42 -06:00
parent f5f16e9b91
commit 3afdd55a15
4 changed files with 50 additions and 23 deletions

View File

@ -78,14 +78,21 @@
checkServer()
.done(function(response) {
audioDomElement.play();
retryAttempts = 0;
if(!response.mount) {
transition(PlayStateSessionOver);
destroy();
}
else {
audioDomElement.play();
transition(PlayStateInitializing);
retryAttempts = 0;
// keep this after transition, because any transition clears this timer
waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT);
transition(PlayStateInitializing);
// keep this after transition, because any transition clears this timer
waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT);
}
})
}
@ -174,21 +181,32 @@
clearBufferTimeout();
// tell audio to stop/start, in attempt to retry
//audioDomElement.pause();
audioDomElement.load();
if(isDesktopSafari()) {
$audio.bind('canplay', function() {
audioDomElement.play();
checkServer()
.done(function(response) {
if(!response.mount) {
transition(PlayStateSessionOver);
destroy();
}
else {
// tell audio to stop/start, in attempt to retry
//audioDomElement.pause();
audioDomElement.load();
if(isDesktopSafari()) {
$audio.bind('canplay', function() {
audioDomElement.play();
})
}
else {
audioDomElement.play();
}
transition(PlayStateRetrying);
waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT);
}
})
}
else {
audioDomElement.play();
}
transition(PlayStateRetrying);
waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT);
}
}

View File

@ -27,8 +27,9 @@ class ApiIcecastController < ApiController
remote_ip = params[:ip]
remote_user_agent = params[:agent]
mount = IcecastMount.find_by_name!(@mount_id)
mount.listener_add
mount = IcecastMount.find_by_name(@mount_id)
mount.listener_add if mount
render text: '', :status => :ok
end
@ -39,8 +40,8 @@ class ApiIcecastController < ApiController
pass = params[:pass]
duration = params[:duration] # seconds connected to the listen stream
mount = IcecastMount.find_by_name!(@mount_id)
mount.listener_remove
mount = IcecastMount.find_by_name(@mount_id)
mount.listener_remove if mount
render text: '', :status => :ok
end

View File

@ -3,6 +3,14 @@ object @music_session
if !current_user
# there should be more data returned, but we need to think very carefully about what data is public for a music session
attributes :id
# only show mount info if fan_access is public. Eventually we'll also need to show this in other scenarios, like if invited
child({:mount => :mount}, :if => lambda { |music_session| music_session.fan_access}) {
attributes :id, :name, :sourced, :listeners, :bitrate, :subtype, :url
node(:mime_type) { |mount| mount.resolve_string(:mime_type) }
node(:bitrate) { |mount| mount.resolve_string(:bitrate) }
node(:subtype) { |mount| mount.resolve_string(:subtype) }
}
else
attributes :id, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter

View File

@ -213,6 +213,6 @@ if defined?(Bundler)
config.send_join_session_email_notifications = true
config.use_promos_on_homepage = true
config.use_promos_on_homepage = false
end
end