当我尝试导出处理视频的Processing小程序在浏览器中工作时,我遇到了一个经常出现的问题。这是一个简单的应用程序,可以停止,播放和暂停.mp4视频。当我使用Processing IDE运行它时,它工作得很好。但是执行我导出时生成的index.html,视频框变为空白,没有任何反应,我在控制台中收到此错误:
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: Could not initialize class quicktime.QTSession
at processing.video.Movie.init(Unknown Source)
at processing.video.Movie.<init>(Unknown Source)
at processing.video.Movie.<init>(Unknown Source)
at sketch_nov14a.setup(sketch_nov14a.java:31)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
也许这是一个已知问题,但我仍然无法找到解决方案:BUG 44
这就是代码:
import processing.video.*;
Movie theMov;
boolean isPlaying;
boolean isLooping;
void setup() {
size(600,400,P2D);
theMov = new Movie(this, "http://www.sinopsedofilme.com.br/processing/video2.mp4");
/* only use 1 of the following options */
theMov.play(); //plays the movie once
theMov.loop(); //plays the movie over and over
isPlaying = true;
isLooping = true;
}
void draw() {
image(theMov, 0,0);
}
void movieEvent(Movie m) {
m.read();
}
void keyPressed() {
if (key == 'p') {
// toggle pausing
if (isPlaying) {
theMov.pause();
} else {
theMov.play();
}
isPlaying = !isPlaying;
} else if (key == 'l') {
// toggle looping
if (isLooping) {
theMov.noLoop();
} else {
theMov.loop();
}
isLooping = !isLooping;
} else if (key == 's') {
// stop playing
theMov.stop();
isPlaying = false;
} else if (key == 'j') {
// jump to a random time
theMov.jump(random(theMov.duration()));
}
}