如何知道歌曲的音频流媒体之前的时间? [英] How to know the Duration of audio song before streaming?

查看:193
本文介绍了如何知道歌曲的音频流媒体之前的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提出的流音频歌曲的应用程序。在自媒体播放器,我必须表明音频文件的总时间。
如果一个音频乐曲将SD卡,我可以用知道它的持续时间

I am making an application for Stream audio song. In Custom media player, i have to show the total duration of that audio file. If a audio song will be SDCard , i can know its duration using

MediaPlayer player;

public double duration() {
        return player.getDuration();
    }

但在我的情况下音频文件在服务器上,所以我必须流呢。

But in my case audio file is on the server, so i have to stream it.

什么是最好的方法呢?

推荐答案

这可能会帮助您:<一href=\"http://www.hrupin.com/2011/02/27/example-of-streaming-mp3-mediafile-with-android-mediaplayer-class\"相对=nofollow>流媒体MP3与Android的媒体播放器类的例子。
相应的数据可能是可用的,一旦prepare()被调用到的流式传输文件。

This might help you: Example of Streaming mp3 with android media player class . The respective data is probably available, once prepare() is called for the file to be streamed.

这篇关于如何知道歌曲的音频流媒体之前的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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