Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SC.stream fails on Firefox, TypeError: t.match(...) is null #68

Open
wmarsey opened this issue Jul 2, 2016 · 8 comments
Open

SC.stream fails on Firefox, TypeError: t.match(...) is null #68

wmarsey opened this issue Jul 2, 2016 · 8 comments

Comments

@wmarsey
Copy link

wmarsey commented Jul 2, 2016

Hi. So I call a basic: SC.stream("/tracks/" + track_id_string).then(handler, errorHandler)

And on Firefox only I get the following error:

TypeError: t.match(...) is null
Stack trace:
p@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:13:23890
f@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:13:23415
r/<@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:18:6074
s@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:18:6310
t.exports</t.exports@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:13:15271
t.exports/<@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:8:18123
R@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:8:2236
N@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:8:2322
x@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:8:2139
m@https://connect.soundcloud.com/sdk/sdk-3.0.0.js:8:759

The error is in this little function:

function p(t) {
    if (!t) return 0;
    var e = t.match(/\d\S+/)[0].replace(/,/g, ".").split(".");
    return parseFloat([e[0], e[1]].join(".")) || 0
}

Error coming from second line. It removes all characters before the first digit in the t string splits the rest by commas. If t = "abc123d,ef" then e = ["123d","ef"]. But you get a type error when there's no digit in the t string.

Not sure why it's only a problem on Firefox. Any ideas?

@yimmyao
Copy link

yimmyao commented Aug 4, 2016

I have the same issue. Here's what it says to me:

Error: Permission denied to access property "href"
widget-49c2ff1f.js:8:29302
TypeError: this.getFlashPlugin(...).match(...) is null
widget-49c2ff1f.js:5:4059
Error: Permission denied to access property "href"
widget-49c2ff1f.js:8:29302
TypeError: this.getFlashPlugin(...).match(...) is null
widget-49c2ff1f.js:5:4059
TypeError: this.getFlashPlugin(...).match(...) is null
widget-49c2ff1f.js:5:4059
Error: Permission denied to access property "href"
widget-49c2ff1f.js:8:29302
TypeError: this.getFlashPlugin(...).match(...) is null
widget-49c2ff1f.js:5:4059
Error: Permission denied to access property "href"

It's killing me!

@MchlG
Copy link

MchlG commented Aug 5, 2016

I had same issue. Decided to use SoundManager2 as my audio player and all works well now simply supply audio player with the proper stream-url

@yimmyao
Copy link

yimmyao commented Aug 6, 2016

MchlG, thanks for the solution but could you develop more? I've downloaded SoundManager2 but I'm not really sure what to do, should I place the folder somewhere?

@MchlG
Copy link

MchlG commented Aug 6, 2016

@yimmyao once you have downloaded SoundManager2, grab one of the script files (there are 4, i believe two of them are minified and two of them are for debugging, choose the one you want to use and you can replace it later if you want), place the script file in your folder where index.html resides. Link the js file to index.html , use this script in the head of your index.html...

    <script>
        soundManager.setup({
          url: '/path/to/swf-files/',
          flashVersion: 9, // optional: shiny features (default = 8)
          // optional: ignore Flash where possible, use 100% HTML5 mode
          // preferFlash: false,
          onready: function() {
            // Ready to use; soundManager.createSound() etc. can now be called.
            console.log("sound manager ready")
          }
        });
    </script>

and then use it like this (many other ways to use it, read the documentation it is excellent)

currentSound = soundManager.createSound({
          id: //give specific id to this sound,
          url: soundcloudStreamURL,
          autoLoad: true,
          autoPlay: false,
          onstop: function(){
            //do something when currentSound.stop is called
          },
          whileloading: function(){
    //do something while loading url
          },
          volume: 50
        }).play();

excellent documentation and examples found here... http://www.schillmania.com/projects/soundmanager2/demo/api/

@yimmyao
Copy link

yimmyao commented Aug 7, 2016

@MchlG thanks for the quick answer! Sorry to bother you again but I've lost you at some point, so I've placed the script where index.html resides (I've chosen soundmanager2.js)

and If got it right, I placed the script you've written this way: http://i.imgur.com/MZho2Ep.jpg

however I didn't understand what to do next when you said "use it like this" should I place that script someplace else too? Also, how do I incorporate it to Firefox?

(You must be having a good laugh by now hah, yes I'm clueless...)

@MchlG
Copy link

MchlG commented Aug 9, 2016

I am not laughing! I am only an egg myself. From your image it looks like you have made a mistake linking the soundmanager.js file after the script you've entered, i think it should be like this

<script src="soundmanager2.js"></script>

<script>
        soundManager.setup({
          url: '/path/to/swf-files/',
          flashVersion: 9, // optional: shiny features (default = 8)
          // optional: ignore Flash where possible, use 100% HTML5 mode
          // preferFlash: false,
          onready: function() {
            // Ready to use; soundManager.createSound() etc. can now be called.
            console.log("sound manager ready")
          }
        });
</script>

So the script i've wirrten goes after the link to the soundmanager.js file. Also, make sure that soundmanager.js is in the same directory (same folder) as your index.html file. Then the part that shows how to use it with a soundcloud URL, that goes in your main.js file, which you should link at the bottom of the body of your index.html. Sorry if my instructions are poor, I myself am new to web dev. If you are still unable to figure it out, you can provide me with your email and I can zip up my working project and send it to you that you may test it locally.

@yimmyao
Copy link

yimmyao commented Aug 11, 2016

Thank you so much, on my way here to see the new instructions... I find that the problem has gone... no updates or anything... just vanished. It's really weird.

@yagni
Copy link

yagni commented Sep 1, 2016

Not sure if this helps anyone, but I had the same problem. Turns out it was because I had another Flash plugin installed (VLC Web Plugin from VLC Media Player installation), so when it tried to parse the Flash version number from the player plugin name, it got no matches and thus the crash. Disabling the VLC Firefox plugin solved it for me.

Unfortunately, the offending code is in a file called widget.js, which I can't find anywhere on the soundcloud GitHub. I'm not sure if this is some non-opensourced part of their code or what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants