airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
202 stars 11 forks source link

Live audio stream make crash in Android #2344

Open D5CN opened 1 year ago

D5CN commented 1 year ago

Problem Description

Play a live stream which just include audio, app will crash in Android

Steps to Reproduce

1.connect to rtmp server and play a stream which just include audio. 2.DO NOT set bufferTime 3.run application in Andorid.

app will crash after some minutes (less than five usually). After set bufferTime to 0.1,it work well. May be stream encode will cause this problem, but why it work well after set bufferTime?and 0.1 is the default value of bufferTime. By the way, set bufferTime to 0,app crash too.

Source code:

`package { import flash.display.Sprite; import flash.text.TextField; import flash.net.NetConnection; import flash.net.NetStream; import flash.media.Video; import flash.events.NetStatusEvent; import flash.display.Screen; import flash.display.Shape; import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.events.Event;

public class Demo extends Sprite
{
    public function Demo()
    {
        this.rtmpPlay();
    }

    private function rtmpPlay():void
    {
        var t:TextField = new TextField();
        t.width = stage.stageWidth;
        t.height = stage.stageHeight;
        t.selectable = false;
        t.multiline = true;
        t.mouseEnabled = false;

        var nc:NetConnection = new NetConnection();
        var client:Object = {};
        client.onMetaData = function(data:*=null):void{};
        client.onBWDone = function(data:*=null):void{};
        nc.client = client;

        var ns:NetStream;
        var v:Video = new Video(160,120);
        v.smoothing = true;

        var onNsStatus:Function = function(e:NetStatusEvent):void
        {
            trace(e.info.code);
            t.appendText("NS@"+e.info.code+"\n");
            t.scrollV = t.maxScrollV;
        }

        var onEnter:Function = function(e:Event):void
        {
            t.text = (ns.bytesLoaded+'/'+ns.bytesTotal+"\nSound:"+ns.liveDelay+"\nTime:"+ns.time);
        }

        nc.addEventListener(NetStatusEvent.NET_STATUS,function(e:NetStatusEvent):void{
            trace("NC@"+e.info.code+"\n");
            t.appendText("NC@"+e.info.code+"\n");
            if(e.info.code=='NetConnection.Connect.Success'){
                ns = new NetStream(nc);
                //ns.bufferTime = 0.1;
                ns.addEventListener(NetStatusEvent.NET_STATUS,onNsStatus);

                ns.client = client;
                v.attachNetStream(ns);
                addChild(v);
                //ns.play("livestream");
                //ns.play("live");
                ns.play("stream_name")
                addEventListener(Event.ENTER_FRAME,onEnter);

            }
        });

        var bg:Sprite = new Sprite();
        bg.graphics.beginFill(0xeeeeee);
        bg.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
        bg.graphics.endFill();
        this.addChildAt(bg,0);

        addChild(t);
        nc.connect("rtmp://live.yourdomain.com/your_app_name/");

    }

}

}`

Describe your problem in detail. Include the following information:

AIR SDK > 33,We have tried at least 6 different versions of SDK.and the lastest version(50.1.1.3) have the same problem. Android

Other information

after set bufferTime to 0.1,the sound will stop a moment in some seconds by got NetStream.Buffer.Empty Event.but it can restore automatically. After restore,it will have 3-5 seconds latency than source sound.

D5CN commented 1 year ago

src_demo.zip

there is my test code. if need a live stream for test please let me know

D5CN commented 1 year ago

This bug is still here in SDK 50.2.3.5