2013-06-19 23 views
3

我想在android中爲icecast服務器開發一個源客戶端。我在網上搜索了很多,但我沒有找到任何正確的解決方案和任何方式來做到這一點。在android中開發icecast源客戶端需要額外的庫嗎?

如果任何人有關於它的知識,請回覆在這裏,我也不懂如何發送元數據icecast服務。

我看下面的鏈接:

@Brad 感謝您的回覆,我 見過很多問題和中更多的人回答你。 只是在等待你的答覆, 感謝 1)我安裝icecast服務,我的本地機器 2)從我的Android程序我連接到的Icecast服務器(TCP連接) 3)的代碼如下

s = new Socket("10.0.2.2",8000); 
      Log.d("VS", "Socket Created"); 
      OutputStream out = s.getOutputStream(); 
      Log.d("VS", "Output Stream Established"); 
      output = new PrintWriter(out); 
      Log.d("VS", "Send Header"); 
      output.println("SOURCE /stream ICE/1.0"); 
      output.println("content-type: audio/mpeg"); 
      output.println("Authorization: Basic c291cmNlOmhhY2ttZQ=="); 
      output.println("ice-name: This is my server name"); 
      output.println("ice-url: http://www.google.com"); 
      output.println("ice-genre: Rock"); 
      output.println("ice-bitrate: 128"); 
      output.println("ice-private: 0"); 
      output.println("ice-public: 1"); 
      output.println("ice-description: This is my server description"); 
      output.println("ice-audio-info: ice-samplerate=44100;ice-bitrate=128;ice-channels=2"); 
      output.println(""); 
      output.flush(); 
      Log.d("VS", "Header sent"); 
      reader = new BufferedReader(new InputStreamReader(s.getInputStream())); 
      for (String line; (line = reader.readLine()) != null;) 
      { 
          if (line.isEmpty()) break; 
          Log.d("VS", "Responce From Server"); 
          Log.d("VS",line); 
      } 
      Log.d("VS", "Sending Password"); 
      output.println("pass:hackme"); 
      output.println(""); 
      output.flush(); 
      for (String aline; (aline = reader.readLine()) != null;) 
      { 
          if (aline.isEmpty()) break; 
          Log.d("VS", "Responce From Server"); 
          Log.d("VS",aline); 
      } 

在logcat的: 插座創建, 輸出流成立, 發送擡頭, 頭派, 性反應從服務器, HTTP/1.0 200 OK, 發送密碼, 後 「發送密碼」 味精有沒有服務器respons即

在這個鏈接http://droidtools.sourceforge.net/content/icecast-client-android有顯示libshout,libvorbis爲android,這些(庫)是需要在android中的源客戶端?

我在安卓development.If檸新出現在代碼或其他方式的任何問題,要做到這一點,請讓我知道。 謝謝

+0

正如我在你掛,http://stackoverflow.com/a/9985297/362536帖子中提到,元數據是通過一個簡單的HTTP請求更新。你能詳細說明你對此不瞭解嗎? – Brad

+0

與icecast服務器連接後。您如何將數據發送到icecast服務器。請分享你的研究 –

+0

@Williams要發送的聲音流服務器必須將音頻編碼爲MP3或ogg.In我的項目的代碼是完全改變了,連接後,我編碼聲音OGG格式,然後發送編碼的實時流媒體服務器。實際上,我使用NDK編碼聲音,沒有選擇按照我的知識在Android中編碼聲音。 –

回答

0

是的,你需要一個額外的庫,用於將PCM數據編碼爲ogg或vorbis或opus格式。通過使用NDK。

1

結帳我的github項目回購android-icecast-broadcast

它捕獲,從麥克風編碼PCM音頻。並播放冰服務器。 我已經包含了本機庫,但你可以自己構建它們。