2

If I do this in Javascript I can play the music streak behind the source url. No problem.

var music = new Audio();
var source = http://*HOST*.grooveshark.com/stream.php?streamKey=*STREAMKEY*;
music.src = source;
music.play();

Even better I can have a web control in my WP7 app that does this, and magically I have music playing in the app. However, I want to have audio int he background as well. So I can't just stream audio in a web browser control.

I need to take the above kind of audio source, but use it in a native Windows Phone app. There seems to be lots of ways, MediaElement, BackgroundAudioPlayer, etc., etc.... but none of them seem to work the the above url. I can pass them a link to an mp3 on a server somewhere and everything goes fine. But I can't seem to stream audio on a windows phone via a url like this.

1 Answer 1

1

Try JavaScript way with Phonegap Media API for Windows Phone

Cordova Media API

and do it look like:

    my_media = new Media("test.mp3", onSuccess, onError);
    function onSuccess() {
        console.log("playAudio():Audio Success");
    }
    // onError Callback 
    //
    function onError(error) {
        alert('code: '    + error.code    + '\n' + 
              'message: ' + error.message + '\n');
    }

Hope this help :)

1
  • That's a very interesting idea... one of the reasons I'm going this path instead of just having a web control where I have a htmlaudioelement is I want to be able to play audio in the background... does the Phonegab framework support this, on windows phone? May 9, 2012 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.