在 Android 中播放音频 RTMP 流的最简单方法 [英] The easiest way to play an audio RTMP stream in Android

查看:105
本文介绍了在 Android 中播放音频 RTMP 流的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了一些 Android RTMP 库(例如:http://rtmpdump.mplayerhq.hu/).

I found some Android RTMP libraries (like this : http://rtmpdump.mplayerhq.hu/).

问题是没有关于我们如何使用它的准确文档.

The problem is that there is no accurate documentation on how we can use it.

就我而言,我有一个简单的 RTMP 实时音频流(例如:rtmp://myserver/myapp/myliveaudio).

In my case, I have a simple RTMP live audio stream (ex: rtmp://myserver/myapp/myliveaudio).

在我的 Android 应用中阅读它的最简单方法是什么?

What is the easiest way to read it in my Android app?

拜托,我不想要链接:我需要一些代码或一些准确的分步说明.

Please, I don't want links: I need some pieces of code or some accurate step-by-step explanation.

非常感谢.

推荐答案

不幸的是,这很难做到.现在最好的办法是查看 http://code.google.com/p/android 中的代码-rtmp-client/:具体看http://code.google.com/p/android-rtmp-client/source/browse/trunk/example/com/ryong21/example/recorder/RecorderClient.javahttp://code.google.com/p/android-rtmp-client/source/browse/trunk/example/com/ryong21/example/recorder/Recorder.java.这些步骤将接收流式 MP3 文件并将其内容记录到磁盘上的 FLV 文件中.

It is unfortunately non-trivially difficult to do. Right now your best bet is to look at the code in http://code.google.com/p/android-rtmp-client/: specifically look at http://code.google.com/p/android-rtmp-client/source/browse/trunk/example/com/ryong21/example/recorder/RecorderClient.java and http://code.google.com/p/android-rtmp-client/source/browse/trunk/example/com/ryong21/example/recorder/Recorder.java. These walk through taking in a streamed MP3 file and recording its contents to an FLV file on disk.

您需要修改 RecorderClient.java 文件(特别是在第 193 行附近)以从扬声器播放音频数据.

You would need to modify the RecorderClient.java file (specifically around line 193) to play the audio data out the speakers.

这篇关于在 Android 中播放音频 RTMP 流的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆