在 windows phone 7 應用程序中流式傳輸音頻 (Streaming audio in windows phone 7 app)


問題描述

在 windows phone 7 應用程序中流式傳輸音頻 (Streaming audio in windows phone 7 app)

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:

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 :)

(by fefwfefefwfweneung)

參考文件

  1. Streaming audio in windows phone 7 app (CC BY‑SA 3.0/4.0)

#audio-streaming #stream #windows-phone-7 #html






相關問題

在 windows phone 7 應用程序中流式傳輸音頻 (Streaming audio in windows phone 7 app)

從 FFMPEG for android 的命令行版本訪問網絡攝像頭麥克風 (Accessing webcam mic from command line version of FFMPEG for android)

Siaran Langsung Node.js: Hindari buffering (Node.js Live Streaming: Avoid buffering)

Icecast 流媒體無法播放 (Icecast streamming not playing)

如何使用 NAudio 在 C# 中解碼 mp3 文件 (how to decode mp3 file in c# using NAudio)

在 Nodejs 中使用 Kurento 複合媒體元素進行音頻會議需要幫助 (Need help for audio conference using Kurento composite media element in Nodejs)

iPhone - 在顯示圖像時使用 UIWebView 流式傳輸音頻 (iPhone - streaming audio using UIWebView while displaying an image)

jQuery:跨瀏覽器問題——調試 Internet Explorer (jQuery: Cross-browser problem -- Debugging Internet Explorer)

在 xuggler 中轉發和倒帶音頻 (forwarding and rewinding audio in xuggler)

網站上的實時音頻流 (Live audio streaming on a website)

如何通過 NAT 流式傳輸 WebRTC 音頻? (How to stream WebRTC audio through a NAT?)

從 WebAPI 在瀏覽器中播放 WAV 文件 (Play WAV file in Browser from WebAPI)







留言討論