MP3 won't stream with JMF

后端 未结 3 1029
陌清茗
陌清茗 2021-02-06 01:50

Basic idea is to access .mp3 file and send it through RTP stream to other client, who will want to play that song.

Here is RTPServer.java, which I found online and modif

3条回答
  •  悲&欢浪女
    2021-02-06 02:19

    Solved.

    All I had to do is add these lines in constructor for sender/receiver.

    Format input1 = new AudioFormat(AudioFormat.MPEGLAYER3);
    Format input2 = new AudioFormat(AudioFormat.MPEG);
    Format output = new AudioFormat(AudioFormat.LINEAR);
    PlugInManager.addPlugIn(
            "com.sun.media.codec.audio.mp3.JavaDecoder",
            new Format[]{input1, input2},
            new Format[]{output},
            PlugInManager.CODEC);
    

    Might help somebody else with this problem :) Still don't know why JMStudio isn't working... Not that I care anymore.

提交回复
热议问题