NUKnightLab / soundcite

Making Inline Audio Easy and Seamless
http://soundcite.knightlab.com
Other
196 stars 44 forks source link

Soundcloud clips timing out? #56

Open JoeGermuska opened 8 years ago

JoeGermuska commented 8 years ago

An organization implementing an article with Soundcloud based clips has reported that the clips are unplayable after "perhaps five minutes".

The dev console shows something like this

Failed to load resource: the server responded with a status of 403 (Forbidden) audiomanager.js:2
GET https://ec-media.sndcdn.com/VPoeoPm4M5V2.128.mp3?f10880d39085a94a0418a7ef69…48cc1203f14cae5260236498f0ebfef4bf23b057ab2bdc4c13941e610fc04aa69b6b24622a
  HTML5AudioPlayer.preload @ audiomanager.js:2
  HTML5AudioPlayer.play @ audiomanager.js:2
  Player.play @ sdk-2.0.0.js:2
  SoundCloudClip.play @ soundcite.min.js?ver=f906988…:4
  Clip.click_handler @ soundcite.min.js?ver=f906988…:4
  (anonymous function) @ soundcite.min.js?ver=f906988…:4

The 403 and the long request parameter make me hypothesize that SoundCloud is now timing out URLs. It should be pretty easy to make a test page and verify that SoundCloud clips time out after a period of time.

The immediate workaround would be to serve MP3s from a regular web server. Maybe we can recognize this 403 error and request a new clip from Soundcloud?

JoeGermuska commented 8 years ago

More information:

I have noticed that sometimes individual SoundCite buttons timeout if the audio hasn't been previously played. When the page loads, the buttons also load on the page. I can hear the audio if I click on a SoundCite button once the page loads. However, if I let the page sit there for a few minutes (I tried 5 minutes) and then I come back to play the audio from some of the SoundCite buttons, I find that only some SoundCite buttons play audio. The only buttons that end up playing audio are buttons that I've previously clicked on once the page loaded. In order to get the button to play the audio, the user needs to refresh the page and click on the button again.

scott2b commented 8 years ago

I am able to reproduce this problem. Clips do consistently timeout. I do not know the exact time, but a 5 minute wait after page load consistently produces a 403 on attempt to play a clip.

I have spent some time trying to figure out how to catch this exception, but still don't have it. Given upcoming changes (updating styles to OrangeLine, updating build process, etc) I recommend that we also consider updating the code to use SoundCloud's sdk v. 3, as we are currently using a deprecated and undocumented version of the sdk. Version 3 includes an error event that might (I'm not sure) give us a handle for dealing with this problem. Another consideration during these changes might be to make the clips load in dynamically rather than binding all of the behavior on page load.