Soundcloud custom player bug [closed] - soundcloud

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Soundcloud fails to acknowledge their bug with the custom players. Many sites are being affected. Here's a link to my previous question
https://stackoverflow.com/questions/16993681/soundcloud-custom-player-skin-not-playing-next-tracks

I can confirm that the bug exists as well. I created an issue about it on their github page, and i have also emailed support. I've spent the last two days trying to see if i could solve it by modifying their code somehow, but i'm pretty sure the bug exists in the actual flash payload that is being delivered via their API, and not on the javascript end of things.
EDIT: ok, i came up with a temporary solution to circumvent soundcloud's bug.
In sc-player.js around line 209 you should see:
load: function(track) {
var url = track.uri;
if(player){
player.api_load(url);
}else{
// create a container for the flash engine (IE needs this to operate properly)
$('<div class="sc-player-engine-container"></div>').appendTo(document.body).html(flashHtml(url));
}
This is the call that injects the new track into the flash player using the api_load call. Problem is that is totally not working right now. so instead of using that api, we just destroy the existing audio engine and replace it with a new one like so:
load: function(track) {
var url = track.uri;
if(player){
// player.api_load(url);
$('.sc-player-engine-container').html(flashHtml(url));
}else{
// create a container for the flash engine (IE needs this to operate properly)
$('<div class="sc-player-engine-container"></div>').appendTo(document.body).html(flashHtml(url));
}
Now it will play tracks after the first track finishes, or when the user switches tracks. This is not optimal because we have to keep loading an extra resource from soundcloud, but soundcloud has left us i a stick situation, and i see no other viable solution at the moment.

Indeed, i noticed that custom player doesn't work properly since few days.
I've found a solution for webkit browsers who support html5 audio only :
you have to include scripts as following (copied from sources):
widget js api: https://w.soundcloud.com/player/api.js
soundcloud.player.api.js (grab from github soundclound custom player)
sc-player.js (grab from github soundclound custom player)
It should solve problems only on html5 audio supported browsers, but it still don't work with the flashplayer fallback. Firefox 21 Mac version doesn't support mp3 yet, and use flash for stream audio...
I'm waiting for an answer from soundcloud dev support about this point.
Cheers.

I was able to fix the problem in Safari and Chrome by following the Soundcloud Github page updates from jQuery 1.4.2 to 1.9.0. https://github.com/soundcloud/soundcloud-custom-player
I also had to replace $.browser.msie with navigator.userAgent.match(/msie [6]/i) as described here: Fancybox doesn't work with jQuery v1.9.0 [ f.browser is undefined / Cannot read property 'msie' ]
I contacted the Soundcloud developer who suggested it could be a Firefox/Flash issue. Updating Flash did nothing for me, and the problem initially occurred simultaneously in all browsers. I applied deweydb's workaround and everything works well.

Related

How to create API with Dart?

I am currently creating a Flutter plugin, but I'm stuck in creating API.
This is an API that I want to create. (Java Example)
JAVA
PeterWorks.UserProperties userProperties = new PeterWorks.UserProperties();
userProperties.setAttrs("user_nick", "peterPark")
.setAttrs("place","Seoul")
.setAttrs("height",180)
.setAttrs("married",false);
Can you give me a sample that how to create that API with Dart?
Thanks.
You should check the types of topics that are normally allowed here, as this is borderline and others my outright flag it. In general, you should be posting specific questions showing what you've actually tried and not "build it for me" questions.
That said, here is a link (no affiliation) I referenced a while ago that focuses on building a basic backend server using Dart. See the second example.

Ionic: Disqus embed loads locally, but not in production (or on an emulator)

I've built a simple Android app, as a companion piece to a publication website, with the Ionic framework, and (after much head-banging), I managed to get the Disqus threads on the app to sync with those on the site. After trying a few different methods, I ended up going with this directive from Michael Bromley to implement the Disqus widget in the app, which is hiding behind a "Comments" button at the bottom of each article on the app's UI.
Running with Ionic Serve, everything works brilliantly. Outside of the local server: not so much. I don't get an error message from Disqus – it simply doesn't load the iframe at all. I'm refraining from posting code, because I'm wondering if this is simply a CORS issue, or maybe something simple that I'm overlooking.
One thing that might be of importance: I don't have the Crosswalk plugin installed on the app – I'm not sure if my thinking is correct, here, but could it be possible that Disqus is compatible with Chrome, which is why it runs fine when I'm testing it on my browser, but isn't compatible with Android's default browser? I'm not extremely well-read on Crosswalk, but I believe it tells the app to use a specific browser – if so, could installing it fix the problem? I'd go ahead and install it, and see if it helps, but I'd like to avoid tampering too much with an otherwise-working app if the issue is something completely unrelated to the plugins.
One weird caveat: The Disqus comments loaded on one article just fine when I tested the app on Genymotion. I deleted that article, and created a new Test article on my site (thus firing up a new Disqus thread), and that failed to render on Genymotion. It seems very... random, I guess, that it would work once. It would seem that it would either work all the time, or never work.
EDIT: While running on Genymotion, no errors appear in the console when debugging the app with WebView. The fact that I'm not getting a "Refused to load" error makes me think that Disqus is getting called and, for whatever reason, is refusing to answer the phone at all.
I can spend hours trying to figure something out, and then... well, as soon as I post a question, I end up figuring out the answer five minutes later.
I dug looked into the code for the directive I was using (which I highly recommend for anybody looking to easily implement Disqus into any AngularJS project), and I noticed that was calling for embed.js with the following string:
....
if (!$window.DISQUS) {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + scope.config.disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
} else {
....
Amending dsq.src = '//' + scope.config.disqus_shortname + '.disqus.com/embed.js';to add a protocol, making it dsq.src = 'http://' + scope.config.disqus_shortname + '.disqus.com/embed.js';fixed the issue on Genymotion. I'll ship the updated APK to the Play Store, and comment on this answer to confirm whether or not it holds up there, as well.

Catching Input Events in WebGL build

When running a Unity project as a WebGL app is there way to catch the site's input events (e.g. keypress) once the application is running?
Currently once the Unity app launches it eats keyboard events so that I can't type in to my text boxes on the page. The best workaround I could come up with is to use jQuery to directly read the keypress event:
$('#input_message').keypress(function(evt){
event.preventDefault();
var code = evt.keyCode || evt.which;
var key=String.fromCharCode(code);
$('#input_message').val($('#input_message').val() + key);
});
};
This works for my immediate needs but I'm hoping there is a cleaner way through the Unity API.
Versions
Chrome v43
Unity 5.1.1f1
I would make this a comment if I had enough points but:
You could have your game send the inputs to your site via websockets. I've done similar things with Azure + SignalR
This question has no solution, so if someone comes up here, there is a short path:
By default, Unity WebGL will process all keyboard input send to the page, regardless of whether the WebGL canvas has focus or not. This is done so that a user can start playing a keyboard-based game right away without the need to click on the canvas to focus it first. However, this can cause problems when there are other HTML elements on the page which should receive keyboard input, such as text fields - as Unity will consume the input events before the rest of the page can get them. If you need to have other HTML elements receive keyboard input, you can change this behavior using the WebGLInput.captureAllKeyboardInput property.
This was taken from here.
The property you are looking for is WebGLInput.captureAllKeyboardInput.

Facebook page is not loading properly in mx:html (Adobe AIR) outside IDE

Adobe AIR application which was working perfectly earlier; is not working now. No idea whether it is due to any recent change in Facebook or Adobe AIR.
I have added the component mx:HTML to display http://facebook.com content. In the development environment (Flash Builder 4.5) after logging in facebook successfully; I can see the TimeLine contents and updates properly. But after build when executed outside the IDE; I am able to login facebook but the timeline or updates are not being displayed properly.
Anybody facing similar issue and has a fix; please provide the solution.
uncaughtScriptException gives following two errors...
TypeError: Result of expression 'bigPipe' [undefined] is not an object.
ReferenceError: Can't find variable: console
I have similar issue, if you catch the javascript errors you will notice that facebook is using some library that fails in AIR, then if you google that exact error you will find similar issues. My solution was to use the FB API and reimplement the functionality(in my case share) , other alternatives is to fix that library or FB code to make it work. I don't remember the details but I fixed it a week ago.
Check the docs for catching the JS errors uncaughtScriptException
I am wondering if that library has code for each browser that it supports and on AIR it fails, maybe changing useragent will help, you need to check the javascript code to see where it fails

Bug in external link tracking when opening the link in a new window in Google Analytics?

First off, I apologize if it's considered poor etiquette to cross-post on stackexchange sites, but this seemed appropriate for both the webmasters site and here, as it's a common issue for webmaster, but may be able to be solved by coders. In any case, here goes...
OK, so this seems like a really simple problem, but I have yet to find a solution that accomplishes the following:
Opens the link in a new window
Tracks the event in GA when using the asynchronous code
Doesn't trigger pop-up blockers (uses target="_blank" instead of window.open)
Most of the code I've seen, including Google's, doesn't take into account the case of opening in a new window - they just use window location.href.
Even GAAddons (http://gaaddons.com/), which charges for commercial use, seems to not manage opening in new windows properly.
Perhaps, I'm missing something simple - I'd be relieved if so and would thank profusely whoever points it out to me!
If no one is able to provide an example, I'll post some of the test cases I've created to illustrate the problem.
Thanks.
[EDIT] I've since tested the GAAddons code more throughly and have found it to work. I'm guessing the problem that was being reported earlier by a client using Chrome 7 on Windows was more likely a configuration issue than something related to the GAAddons library itself.
You put it in the link's onclick attribute:
some link
The method I've found to satisfy all the requirements I've mentioned is the one found here:
http://cutfromthenorth.com/add-external-link-tracking-with-jquery-and-google-analytics/
It's actually quite simple, leading me to think that there was some other reason why other code wasn't working in earlier tests.
However, I can confirm that the method that's mentioned in the comments on this Google page - http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55527 - does not meet the above requirements (new windows trigger popup warning on Chrome and IE).
The Google code does work for tracking external links not opened in a new window.
here's the snippet:
$('a[target=_blank]').click(function(){
try{
_gaq.push(['_trackEvent', 'External Links', 'Click', $(this).attr('href')]);
} catch(err) {}
return true;
});
I've tested on the following browsers:
PC:
IE 6 - 9
Firefox 3.6, 4.0
Chrome 9, 10
Safari 5
Opera 11
Mac:
Safari 5
Chrome 10
Firefox 3.6, 4.0
Also tested on iPhone 4 and the native Android browser on Gingerbread