rcaloras / gwt-soundmanager2 Goto Github PK
View Code? Open in Web Editor NEWUpdated GWT SoundManager2 wrapper
Home Page: www.coolhandjuke.com
License: MIT License
Updated GWT SoundManager2 wrapper
Home Page: www.coolhandjuke.com
License: MIT License
Calling getBytesLoaded() on an mp3-file shortly after I having created it throws and exception with the following stack trace. The result is also similar if i call getBytesTotal().
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Thread.java:722) Caused by: com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.chj.gwt.client.soundmanager2.SMSound::bytesLoaded()': JS value of type null, expected int at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266) at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75) at com.chj.gwt.client.soundmanager2.SMSound.bytesLoaded(SMSound.java) at com.chj.gwt.client.soundmanager2.SMSound.getBytesLoaded(SMSound.java:55)
Code for reproducing:
String id = "music";
m_soundManager.createSound( id, "music.mp3" );
int loaded = m_soundManager.getSoundById(id).getBytesLoaded();
Neither onLoad() nor onError() is called when SoundManager has been initialized using the following code. As far as I understand things, one of them should be called.
public class SoundSys {
//_________________________________________________________________________
private class OnReady implements Callback {
private SoundSys m_parent;
public OnReady( SoundSys parent ) {
m_parent = parent;
}
public void execute() {
m_parent.m_bReady = true;
}
}
//_________________________________________________________________________
private class OnError implements Callback {
private SoundSys m_parent;
public OnError( SoundSys parent ) {
m_parent = parent;
}
public void execute() {
m_parent.m_bError = true;
}
}
//_________________________________________________________________________
private SoundManager m_soundManager = null;
private boolean m_bReady = false;
private boolean m_bError = false;
//____ Constructor ________________________________________________________
public SoundSys() {
m_soundManager = SoundManager.getInstance();
m_soundManager.setUseHtml5Audio(true);
m_soundManager.onLoad( new OnReady(this) );
m_soundManager.onError( new OnError(this) );
m_soundManager.beginDelayedInit();
}
}
When i call to this method:
public void whileLoading(Callback callback) {
executeWhileLoading(callback);
}
Throws a JSNI exception because the return value of the next function are undefined and GWT expected a boolean.
private native boolean executeWhileLoading(Callback callback)/-{
$wnd.soundManager.defaultOptions.whileloading = function() {
[email protected]::execute()();
}
}-/;
I run GWT 2.5.1 and javaJDK-1.7.0_01
I replace boolean for void and the app works.
Greetings.
In the SoundManager.java file there this line that seems to be quite no right (the parameter auto should be used not the isMp4) :
private native void isMovieStar(boolean auto)/-{
$wnd.soundManager.defaultOptions.isMovieStar = isMp4;
}-/;
I'm actually using the 0.1.3 version.
Hi,
When I take a look at your code in the SoundManager.java file we can see there is a missing dot between soundManager and defaultOptions in the setVolume method :
public void volume(int volume) {
setVolume(volume);
}
private native void setVolume(int volume) /-{
$wnd.soundManagerdefaultOptions.volume(volume);
}-/;
I'm actually using the 0.1.3 version.
Hi
I am unable to play a wav file using SoundManager2 lib.
Here is my code
final String SOUND_ID = "soundId_wav";
final SoundManager sm = SoundManager.getInstance();
sm.beginDelayedInit();
//Play our sound once SoundManager2 has loaded
sm.onReady(new com.chj.gwt.client.soundmanager2.Callback(){
public void execute() {
sm.play("FR60171", "ftp://uname:pwd@Ip/Path.wav);
}
});
I get the following output when i run this piece of code
FR60171: Failed to load? - ftp://uname:pwd@Ip/Path.wav
FR60171: play(): Starting to play
(Flash): auto-play allowed
FR60171: load (ftp://uname:pwd@Ip/Path.wav)
FR60171: play(): Attempting to load
FR60171: Merged options:
soundManager.createSound(): FR60171 ftp://uname:pwd@Ip/Path.wav
soundManager.play(): attempting to create "FR60171"
"FR60171" is an invalid sound ID.
SoundManager 2 loaded (OK)
SoundManager 2 HTML5 support: mp3 = true (preferring flash), mp4 = true (preferring flash), ogg = false (and no flash support), opus = false (and no flash support), wav = false (and no flash support)
SoundManager V2.97a.20130324 (AS2/Flash 8) + HTML5 audio + preferFlash
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.