Soundmanager2 Soundcloud API crossdomain.xml -
i using soundmanager2 stream files soundcloud , display eq visuals, i'm having problem getting eqdata when pausing or changing track.
shown here
i understand flash unable access metadata due cross domain policy defined in "crossdomain.xml" file on soundcloud seen in post: (and many others)
how utilize soundmanager2 stream soundcloud, , create visualizations?
i realize have resolve track's stream_url before loading sound manager. i'm doing ajax phone call php script resolves url (shown below):
var client_id = '866143113772fec9556700f7f88f3abc', url = 'http://api.soundcloud.com/resolve.json?url=http://soundcloud.com/aries-audio-music/tracks&client_id='; $.getjson(url+client_id+'&callback=?', function(playlist){ $.each(playlist, function(index, track) { //append playlist $('<li id="tr-'+track.id+'">' + track.title + '</li>').data('track', track).appendto('.tracks'); //get resolved stream url $.ajax({ type: 'get', url: 'get_sc_url.php?id='+track.id, success: function(data) { console.log(data); sm2_addtrack(track, data); //create sm2 sound object resolved url } }); }); }); function sm2_addtrack(track, stream_url) { soundmanager.createsound({ id: 'track_' + track.id, url: stream_url, usepolicyfile : true, usepeakdata: false, usewaveformdata: false, useeqdata: true, .....
get_sc_url.php used resolve stream_url
<?php require 'include/referrer_check.php'; require 'include/sc_api_key.php'; require 'include/api_cache.php'; $track_id = intval($_get['id']); $key = get_soundcloud_api_key(); $api_call = 'http://api.soundcloud.com/tracks/'.$track_id.'/stream/?client_id='.$key; function get_web_page($url) { /* * hat tip: http://forums.devshed.com/php-development-5/curl-get-final-url-after-inital-url-redirects-544144.html */ $options = array( curlopt_followlocation => true, curlopt_returntransfer => false, // homecoming web page curlopt_header => true, curlopt_nobody => true, curlopt_connecttimeout => 5, // timeout on connect curlopt_timeout => 5, // timeout on response curlopt_maxredirs => 10, // stop after 10 redirects curlopt_returntransfer => true, // homecoming web page ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); homecoming $header; } $myurlinfo = get_web_page($api_call); echo $myurlinfo["url"]; ?>
the result getting this:
ec-media.soundcloud.com/ez0b3luzjjcr.128.mp3?f10880d39085a94a0418a7ef69b03d522cd6dfee9399eeb9a52200996dfabd3cefb29b7554ff4fd02baab5100d3a070e07d55f6e1eb41808c65398ce84cd496788c171f7e4&awsaccesskeyid=akiajnigglk7xa7yzsnq&expires=1415223069&signature=a0qac1nr3%2fxw4jwfymja%2f98arwi%3d
which plays gives me no spectrum info @ , still computespectrum() (eq data) securityerror: error #2123 soundmanager2.
i know sure ec-media.soundcloud.com/crossdomain.xml beingness downloaded, still can't solve problem.
i think may because i'm trying access soundcloud crossdomain.xml policy file (which https) http document. secure="false" not defined in soundcloud's crossdomain.xml policy file defaults secure="true", hence swf can not access anything.
i uncertainty soundcloud ever set secure="false" in crossdomain.xml obvious reasons (it defeats purpose of having https).
i "think" why computespectrum() (eq data) securityerror: error #2123, don't have access https enabled server test wrong.
soundcloud soundmanager2
No comments:
Post a Comment