Playing local MP3


<strong>The method below creates player and play mp3 file.</strong>
<strong>public void run()</strong>
<strong>{</strong>
<strong> try</strong>
<strong> {</strong>
<strong> InputStream is = getClass().getResourceAsStream(”/your.mp3?);</strong>
<strong> player = Manager.createPlayer(is,”audio/mpeg”);</strong>

<strong>player.realize();</strong>
<strong> // get volume control for player and set volume to max</strong>
<strong> vc = (VolumeControl) player.getControl(”VolumeControl”);</strong>
<strong> if(vc != null)</strong>
<strong> {</strong>
<strong> vc.setLevel(100);</strong>
<strong> }</strong>
<strong> player.prefetch();</strong>
<strong> player.start();</strong>
<strong> }</strong>
<strong> catch(Exception e)</strong>
<strong> {}</strong>
<strong>}</strong>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Zoemalang's community

ujung malang adalah Sebuah desa yang hilang terganti dengan ujung harapan

YoYo Games Blog Feed

Ujung malang adalah Sebuah desa yang hilang terganti dengan ujung harapan

Dealer Termurah

Menjual Segala Jenis Motor Baru Di Indonesia Cash Maupun Kredit

%d blogger menyukai ini: