[Tiện ích] - Phát nhạc trong ứng dụng Java desktop - Play sound in java application

Discussion in 'Other usefull class' started by tranhuyvc, 5/9/10.

  1. Joe

    Joe Moderator

    ManOhMan,
    it's ok if you copy the codes, but you should pay more attention on what the author said
    . And, furthermore, what the error message told you
    You "rape" the codes by letting them roll over a MP3....
    tranhuyvc likes this.
  2. tranhuyvc

    tranhuyvc Administrator Staff Member

    No line matching interface SourceDataLine supporting format PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4 bytes/frame
    đọc lỗi cũng biết file sound bạn truyền vô mặc định decode không hỗ trợ nhé, bạn test bằng file wav xem nhé
  3. Joe

    Joe Moderator

    Hoangosb,
    it's always a good habit that a developer studies the case theoretically before he or she starts to materialize his/her approach. Even when he/she copies somewhere the codes. And you should try to make this habit to your own habit. If you read the TRUE source of JAVA sound processing then you have to go to the ORACLE (former SUN) site and try to acquire the information. In your case: click HERE. Read it and, especially, pay more attention to the next page. Knowledge is always available and accessible. Only UNavailable and INaccessible for those who are too lazy to read. Example:
    Meaning: MP3 is NOT supported and that was the exception you got.
    If you want to access to MP3 and play it you have only 2 choices:
    1) look for a 3rd party provider if your app is written in "conventional" JAVA
    2) implement your app in JFX. Click HERE -section pitfall with MediaPlayer. Here you will see how MP3 is implemented with JFX, JFX/SWING and 3rdPary JavaZOOM.
  4. hoangosb

    hoangosb Member

    Thanks các anh nhiều! em đã làm được. :D:D:D

Chia sẻ trang này