java实战——简单的媒体播放器

这个是用jmf来做的,但是由于jmf对视频资源支持的问题所以能用的类型没有那么多,它支持的格式有下面这些。

· D indicates the format can be decoded and presented.

· E indicates the media stream can be encoded in the format.

· read indicates the media type can be used as input (read from a file)

· write indicates the media type can be generated as output (written to a file)

Media Type

JMF 2.1.1
Cross Platform Version

JMF 2.1.1
Solaris/Linux Performance Pack

JMF 2.1.1
Windows Performance Pack

AIFF (.aiff)

read/write

read/write

read/write

8-bit mono/stereo linear 

D,E

D,E

D,E

16-bit mono/stereo linear 

D,E

D,E

D,E

G.711 (U-law) 

D,E

D,E

D,E

A-law 

D

D

D

IMA4 ADPCM

D,E

D,E

D,E

AVI (.avi)

read/write

read/write

read/write

Audio: 8-bit mono/stereo linear 

D,E

D,E

D,E

Audio: 16-bit mono/stereo linear 

D,E

D,E

D,E

Audio: DVI ADPCM compressed 

D,E

D,E

D,E

Audio: G.711 (U-law) 

D,E

D,E

D,E

Audio: A-law 

D

D

D

Audio: GSM mono

D,E

D,E

D,E

Audio: ACM**

-

-

D,E

Video: Cinepak 

D

D,E

D

Video: MJPEG (422)

D

D,E

D,E 

Video: RGB

D,E

D,E

D,E 

Video: YUV

D,E

D,E

D,E 

Video: VCM**

-

-

D,E

GSM (.gsm)

read/write

read/write

read/write

GSM mono audio

D,E

D,E

D,E

HotMedia (.mvr)

read only

read only

read only

IBM HotMedia

D

D

D

MIDI (.mid)

read only

read only

read only

Type 1 & 2 MIDI

-

D

D

MPEG-1 Video (.mpg)

-

read only

read only

Multiplexed System stream 

-

D

D

Video-only stream 

-

D

D

MPEG Layer II Audio (.mp2)

read only

read/write

read/write

MPEG layer 1, 2 audio 

D

D,E

D,E

QuickTime (.mov)

read/write

read/write

read/write

Audio: 8 bits mono/stereo linear 

D,E

D,E

D,E

Audio: 16 bits mono/stereo linear

D,E

D,E

D,E

Audio: G.711 (U-law) 

D,E

D,E

D,E

Audio: A-law 

D

D

D

Audio: GSM mono 

D,E

D,E

D,E

Audio: IMA4 ADPCM 

D,E

D,E

D,E

Video: Cinepak 

D

D,E

D

Video: H.261

-

D

D

Video: H.263 

D

D,E

D,E

Video: JPEG (420, 422, 444) 

D

D,E

D,E

Video: RGB

D,E

D,E

D,E

Sun Audio (.au)

read/write

read/write

read/write

8 bits mono/stereo linear 

D,E

D,E

D,E

16 bits mono/stereo linear 

D,E

D,E

D,E

G.711 (U-law)

D,E

D,E

D,E

A-law 

D

D

D

Wave (.wav)

read/write

read/write

read/write

8-bit mono/stereo linear 

D,E

D,E

D,E

16-bit mono/stereo linear 

D,E

D,E

D,E

G.711 (U-law)

D,E

D,E

D,E

A-law 

D

D

D

GSM mono 

D,E

D,E

D,E

DVI ADPCM

D,E

D,E 

D,E

MS ADPCM

D

D

ACM**

-

-

D,E

资料来源:https://blog.csdn.net/attilax/article/details/41144919

另外如果要播放MP3等音乐类型的话需要去官网上下载jmf mp3 plugin,这样才能用,不然就会像我想播放MP4格式的时候一样报错...

 因为这个东西实在太low,所以就不多做介绍了,让大家看看效果图吧。

 这个是刚进入时的页面。

这里可以看到打开后播放的信息。

这是打开wav文件后的样子,可以控制它的播放停止等等,也可以看到详细信息如下图。 

 不多说了,如果有兴趣的话可以关注公众号,发送  媒体播放器  把源码下下来修改一下,希望到时候不要吝啬与大家分享哟~~

猜你喜欢

转载自blog.csdn.net/qq_39391192/article/details/82290256