-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
2.0, 1.1.7
-
other, x86
-
solaris_2.6, windows_nt
Name: keC81026 Date: 04/02/99
AudioClip doesn't play audio file as expected with jdk1.1.7.
to reproduce
1. compile SoundApplet.java
2. execute "appletviewer example1.html"
3. Note, that if sound.wav may be au-stereo, wav-mono, wav-stereo, you will get an error :
]=================================================
NativeAudioStream: invalid file type.
NativeAudioStream: invalid file type.
]=================================================
====================== SoundApplet.java =============================
import java.awt.Graphics;
import java.applet.*;
import java.net.URL;
import java.net.MalformedURLException;
public class SoundApplet extends Applet {
/** The URL of the sound to be played. */
URL sound;
AudioClip soundData = null;
boolean isReady;
public void getMedia() {
try {
sound = new URL(getDocumentBase(), "sound.wav");
if (sound != null && soundData == null) {
soundData = getAudioClip(sound);
}
if (soundData == null) {
System.out.println("SoundArea: Unable to load data "+sound);
}
isReady = true;
} catch (Exception e) {
};
}
public void enter() {
if (! isReady) {
showStatus("Loading media file...");
return;
}
long now = System.currentTimeMillis();
soundData.play();
}
public void init( ) {
getMedia();
enter();
}
public SoundApplet() {
super();
};
}
=========== example1.html =================================================
<html>
<body>
<applet code=SoundApplet.class width=10 height=10>
</applet>
</body>
</html>
===========================================================================
======================================================================
- duplicates
-
JDK-4223119 Audio file does not work on Solaris HJB (OK with javastation)
- Closed
-
JDK-4226300 AudioClip does not play audio files as expected
- Closed