processing 多个视频播放

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

processing制作循环播放视频问题

来自: colour-4([器味生活设计]) 2012-04-03 09:46:51

我想问可否用processing实现一个功能,

1.轮流,循环播放5段电影(编号1、2、3、4、5)。全屏,无需鼠标键盘交互。

2.播放每段影片开始时候,向串口发送当前电影编号字符(1、2、3、4、5)。即比如某时刻开始播放影片1,则发串口文字“1”

3.五段视频播放完毕,有一个短暂间隔。

第一个点是重点,后面两个希望有空也帮忙解决一下。因为涉及到毕业创作,所以比较赶,要是能帮我解决万分感激啊~

import processing.video.*;

String PATH = "C:/Users/Blane/Desktop/emptyderry.mp4";

Movie mov;

Movie mov1;

Movie mov2;

Movie mov3;

int newFrame = 0;

int movFrameRate = 30;

boolean speedSet = false;

boolean once = true;

boolean ismov=false;

boolean ismov1 =false;

boolean ismov2 =false;

boolean ismov3 =false;

boolean isPlaying;

boolean isLooping;

void setup() {

size(640, 360);

background(0);

// Load and set the video to play. Setting the video

// in play mode is needed so at least one frame is read

// and we can get duration, size and other information from

// the video stream.

// frameRate(25);

// mov = new Movie(this, PA TH);

//mov.play();

// mov.speed(5);

// mov.volume(0);

mov = new Movie(this, "transit.mov");

// mov.loop();

mov1 = new Movie(this, "one.mov");

// mov1.loop();

mov2 = new Movie(this, "two.mov");

//mov2.loop();

mov3 = new Movie(this, "three.mov");

// mov3.loop();

}

void movieEvent(Movie m) {

m.read();

// if (speedSet == true) {

// speedSet = false;

// }

}

void draw() {

background(0);

if(ismov==true){

image(mov, 0, 0, width, height);}

if(ismov1==true){

image(mov1, 0, 0, width, height);}

if(ismov2==true){

image(mov2, 0, 0, width, height);}

if(ismov3==true){

image(mov3, 0, 0, width, height);}

fill(255);

text(getFrame() + " / " + (getLength() - 1), 10, 30); }

void Rverse(Movie movie)

{

if (speedSet == false && once == true) {

// Setting the speed should be done only once,

// this is the reason for the if statement.

speedSet = true;

once = false;

movie.jump(mov.duration());

// -1 means backward playback at normal speed.

movie.speed(-1.0);

// Setting to play again, since the movie stop

// playback once it reached the end.

movie.play();

}

}

void moviespeed(Movie movie)

{

float newSpeed = map(mouseX, 0, width, 0.1, 2);

movie.speed(newSpeed);

fill(255);

text(nfc(newSpeed, 2) + "X", 10, 30);

}

void moviescratch(Movie movie)

{

if (movie.available()) {

movie.read();

// A new time position is calculated using the current mouse location: float f = map(mouseX, 0, width, 0, 1);

float t = movie.duration() * f;

movie.play();

movie.jump(t);

movie.pause();

}

}

void movieplay(Movie movie)

{

// Pausing the video at the first frame.

mov.play();

// mov.jump(0);

// mov.pause();

}

void movieloop(Movie movie)

{

movie.loop();

}

void moviestop(Movie movie)

{

movie.stop();

}

void keyPressed() {

// if (key == CODED) {

相关文档
最新文档