Android的AudioFlinger服务器死亡|媒体服务器死亡 [英] Android AudioFlinger server died | media server died

查看:3259
本文介绍了Android的AudioFlinger服务器死亡|媒体服务器死亡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发Android设备上的一个HLS的球员,我有一些测试流我可以玩。一个问题,我有是,HLS流只是停止,在一些随机位置冻结,也可能是1分钟后,或20后,我得到的错误是:

I am trying to develop a hls player on android devices, and i have some test-streams i can play with. A problem i have is that the HLS stream just "stops", freezes at some random locations, it could be after 1 minute, or after 20. The error i get is:

11-20 14:14:10.484:W / AudioSystem(18531):AudioFlinger服务器死了!
11-20 14:14:10.484:W / IMediaDeathNotifier(18531):媒体服务器死亡

11-20 14:14:10.484: W/AudioSystem(18531): AudioFlinger server died! 11-20 14:14:10.484: W/IMediaDeathNotifier(18531): media server died


11-20 14:14:10.484:E / MediaPlayer的(18531):错误(100,0)

and 11-20 14:14:10.484: E/MediaPlayer(18531): Error (100,0)

我已经有了基本了解如何prevent或重新启动,如果发生这种情况该流不知道。我甚至不知道为什么会发生。所以,如果有人能回答这个问题,我会非常高兴。)

I've got basically no idea on how to prevent or restart the stream if this is happening. I don't even know why it happens. So if someone could answer that question, i would be very happy :).

 // Create a new media player and set the listeners
        mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
            public boolean onError(MediaPlayer mp, int what, int extra) {
                mMediaPlayer.reset();
                return false;
            }
        });
        mMediaPlayer.setDataSource(path);
        mMediaPlayer.setDisplay(holder);
        mMediaPlayer.prepareAsync();
        //mMediaPlayer.prepare();
        if(extras.getString("type") == "VOD") {
            mMediaPlayer.setOnBufferingUpdateListener(this);
            mMediaPlayer.setOnCompletionListener(this);
        }
        mMediaPlayer.setOnPreparedListener(this);
        mMediaPlayer.setScreenOnWhilePlaying(true);


        //mMediaPlayer.setOnVideoSizeChangedListener(this);
        //mcontroller = new MediaController(this);
        mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);


    public void onPrepared(MediaPlayer mediaplayer) {
    Log.d(TAG, "onPrepared called");
    mIsVideoReadyToBePlayed = true;
    if (mIsVideoReadyToBePlayed) {
        runOnUiThread(new Runnable() {
            public void run() { 
                startVideoPlayback();
            }
        });
    }
    mcontroller = new MediaController(this);
    mcontroller.setMediaPlayer(this);
    mcontroller.setAnchorView(findViewById(R.id.surface));
    mcontroller.setEnabled(true);
    handler.post(new Runnable() {

        public void run() {
            mcontroller.setEnabled(true);
            mcontroller.show();
        }
    });
}

请告诉你,如果需要更多的code。

Please tell if you need more code.

推荐答案

我想这正是它说:网络问题所作的的MediaPlayer 认为服务器关闭了连接

I think it's just what it says: network issues have made the MediaPlayer think the server closed the connection.

有关HTTP流,我建议在设备上坚持一个简单的代理服务器,以便您对并发送给玩家的数据更多的控制。 Apache的库pretty方便自己使用,或者你可以拿起一个轻量级的包装一样的娜迦。你可以在你喜欢这个错误的情况下离开了精确的字节作出重新连接请求。也有其他好处,如能够如果需要缓存的数据,但在远程通讯的控制是提供一个自由的水平,你将不会以其他方式找到的MediaPlayer

For HTTP streaming, I would suggest sticking a simple proxy server on the device so that you have a bit more control over the data that gets sent to the player. The Apache libraries are pretty easy to use by themselves, or you can pick up a lightweight wrapper like Naga. You can make reconnect requests at the exact byte you left off in case of errors like this. There are other benefits, like being able to cache data if so desired, but being in control of the remote communication provides a level of freedom you won't otherwise find with the MediaPlayer.

请注意以供将来参考:这个答案是不利于HLS。查看评论。

Note for future reference: this answer wasn't good for HLS. See the comments.

这篇关于Android的AudioFlinger服务器死亡|媒体服务器死亡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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