I'm streaming music from the soundcloud API, and sometimes when I call SC.stream the track does not stream and I get the error:
"GET http://api.soundcloud.com/tracks/80608808/stream?client_id=78bfc6a742a617082972ddc5ef20df2a 404 (Not Found)"
The GET request works for some tracks and not for others. I cannot figure out why or if there is an issue with the SC API.
He is a replication of my problem on plnkr:
http://plnkr.co/edit/TMVWGg
Thanks!
This is because some soundcloud tracks are not streamable via api. You can check this for each track by property "streamable".
Related
I want to test my Progressive web application for offline status. I want that if my webapp if offline, it should respond with a 200 status code. What can be the possible code for that?
Your question is not detailed enough to give a detailed answer but in general:
it sounds like the 200 status code is from an HTTP request, in which case if your PWA uses javascript (e.g. via ajax) to make the remote API calls (e.g. GET) then you just handle the state in the returned event object, e.g. you have to handle other states (e.g. other types of failures too). For example see: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started
You also could also test the online/offline state before making the HTTP request.
See discussion of using navigator.onLine or adding
window.addEventListener('offline', function(e) {//do something}, false);
window.addEventListener('online', function(e) {//do something}, false);
Another example is I use Polymer webcomponents and firebase authentication for my PWAs and in Polymerfire it's simply a case of handling the online property.
Is there any possibility of "listening" to the state of GET SiteCatalyst image requests ?
I'd like to run a callback function only when the requests are over, to be more clear when they receive the 200 status code and I'm sure they're done.I'm confident no "built-in" method is available and maybe I should hack the core s.track.s.t() function...?Thanks a lot.
You are right, there is no global "built-in" callback method for when the Adobe Analytics request is complete.
A couple notes I should mention to you about attempting to hack the core code:
1) If you are using the AppMeasurement library version 1.4.1+, in some circumstances, a POST request may be made instead of an image request.
2) Responses that are not 200/OK or otherwise completed/successful does not necessarily mean the data failed to be sent to Adobe. Most common scenario is a NS_BINDING_ABORTED error returned.
The main bad effect I'm getting here is what I previously thought as a double XHR request.
It wasn't. In reality the first request gets redirected as it would be the first visit of a new visitor (302 status) and a new visitorID is brought down by Adobe server.
Then the redirected "200 status" request is made with this new visitorID within.This is bad because every XHR requests would result in a new visit of a new visitor even though a previously set "s_vi" cookie is there in browser, with the lack of previous collected data for that user.I know what XHR redirects couldn't be blocked so I'm wondering if there is a way to "tell" Adobe server it's not the first request ever made, in order to stop the redirect and do not use a new visitorID.
When calling this api:
https://api.soundcloud.com/tracks.json?offset=0&q=ben+pearce&filter=streamable&order_by=hotness&consumer_key=[XXX]
I get a track that is NOT streamable, even though I've added &filter=streamable to the request. Am I doing it wrong?
I'm trying to get a grasp on how to reverse engineer the URL's to download streams.
I know there are allready Open Souce tools, that do that, but by copying them i do not get the process of how to do it.
As an Example: I try to get a downloader for soundcloud to work. Im guessing the download url should be something like api.soundcloud.com/track/... . Somewhere inbetween there surely are the track_id and client_id which can be excracted from the source of the page.
But i can't seem to get further than that right now.
Before I answer my own post, i want to state, that downloading Streams from Soundcloud is illegal and hurts the artists. Also playing the stream outside of Soundcloud is only allowed under their terms, so please check those first.
So to grab the Stream Link i first looked into the Soundcloud Python Library. There i found, that i can just question the API with api.soundcloud.com/resolve?url=<URL of the desired Song Page>&client_id=<client_id>.
The Client id has to be sent with each api request. Searching trough the code its really easy to find a client_id. It seems to be static for unregistered users at least and further searching for it suggested, that it is that way for at least a year.
After you call the resolve URL above you get an XML document with properties of the Song/Stream. There you will find the Stream URL. You can just make a normal HTTP Request for that Stream URL. (Don't forget to append the client_id).
If for some reasons the link doesn't work properly, try disabling your 302 HTTP redirections.
We have a http live streaming running on our iOS app. We want to get thumbnail images every 1 minute. I tried using MPMoviePlayerController methods
thumbnailImageAtTime:timeOption:
and
requestThumbnailImagesAtTimes:timeOption:
But both these options return nil. The documentation doesn't say if these methods do not work for http live streaming. Any ideas what could be the issue?
Now documentation for this method says:
"This method is not not called when the source URL is an HTTP Live Streaming (HLS) content source. See HTTP Live Streaming Overview."
Try registering for MPMoviePlayerThumbnailImageRequestDidFinishNotification before calling this method and on getting notification check value of this key MPMoviePlayerThumbnailImageKey. In case image capture was successful value of this key will contain a valid UIImage for you to use.