void ImageBox::revealImage() { imageStack->raiseWidget( 0 ); restartMovie(); }
//------------------------------------------------------------------------- void pmWarpPiRendererVideoPlayer::updateOSC(ofxOscMessage* m) { ofLog(OF_LOG_NOTICE) << "VideoPlayer-OSC" << endl; string address = m->getAddress(); // get the id string addressWithoutSlash = address.substr(1,address.size()-1); if(true)// It will be for me it they send it (address=="/all")||(id==addressWithoutSlash)) { /// THIS MESSAGE IF FOR YOU !! /// COMMAND string command = m->getArgAsString(0); /// Change Volume if(command == "volume"){ audioVolume = m->getArgAsFloat(1); } else if(command == "loop"){ this->setPlayerLoop(m->getArgAsBool(1)); cout<< "Set loop State: " << m->getArgAsBool(1) << endl; ofLog(OF_LOG_NOTICE) << "Set Loop State: " << loop; } /// PLAY else if(command == "playVideo") { if (isPlayerPaused() && !isFading){ float fade = m->getArgAsFloat(1); //videoPlayer.play(); if(!activePlayer){ activePlayer = true; ofNotifyEvent(swapEvent, fade, this); } setPlayerPaused(false); Tweenzor::add((float *)&screenOpacity.get(), 0.0, maxScreenOpacity, 0.0, fade, EASE_IN_OUT_EXPO); Tweenzor::addCompleteListener(Tweenzor::getTween((float*)&screenOpacity.get()), this, &pmWarpPiRendererVideoPlayer::onComplete); isFading = true; } } /// STOP else if(command == "stopVideo") { if(!isPlayerPaused() && !isFading){ Tweenzor::add((float *)&screenOpacity.get(), screenOpacity, 0.0, 0.0, m->getArgAsFloat(1),EASE_IN_OUT_EXPO); Tweenzor::addCompleteListener( Tweenzor::getTween((float*)&screenOpacity.get()), this, &pmWarpPiRendererVideoPlayer::onComplete); isFading = true; } } /// PAUSE else if(command == "pauseVideo") { if(isPlayerPaused()) setPlayerPaused(false); else setPlayerPaused(true); } /// RESTART else if(command == "restartVideo") { if(!isFading){ restartMovie(); Tweenzor::add((float *)&screenOpacity.get(), 0.0, maxScreenOpacity, 0.0, m->getArgAsFloat(1),EASE_IN_OUT_EXPO); Tweenzor::addCompleteListener( Tweenzor::getTween((float*)&screenOpacity.get()), this, &pmWarpPiRendererVideoPlayer::onComplete); isFading = true; } } /// LOAD MOVIE else if(command == "loadVideo") { if (!isFading){ auto new_videoFileName = "./videos/" + m->getArgAsString(1); ofFile videoCheck(new_videoFileName); if(videoCheck.exists()){ cout<<"Loading Video: " << new_videoFileName << endl; fadeTime = m->getArgAsFloat(2); videoFileName = new_videoFileName; if(!activePlayer){ activePlayer = true; ofNotifyEvent(swapEvent, fadeTime, this); loadMovie(); Tweenzor::add((float *)&screenOpacity.get(), 0.0, maxScreenOpacity, 0.0, fadeTime, EASE_IN_OUT_EXPO); Tweenzor::addCompleteListener( Tweenzor::getTween((float*)&screenOpacity.get()), this, &pmWarpPiRendererVideoPlayer::onComplete); } else{ Tweenzor::add((float *)&screenOpacity.get(), maxScreenOpacity, 0.0, 0.0, fadeTime, EASE_IN_OUT_EXPO); Tweenzor::addCompleteListener( Tweenzor::getTween((float*)&screenOpacity.get()), this, &pmWarpPiRendererVideoPlayer::onFadeOutComplete); isFading = true; } ofLog(OF_LOG_NOTICE) << "VideoPlayer-LoadVideo: " << videoFileName << " - fadeTime: " << fadeTime; } else{ ofLog(OF_LOG_ERROR) << "VideoPlayer - No VideoFile"; cout<< "No Videofile: " << new_videoFileName << endl; } } } } pmWarpPiRendererDrawable::updateOSC(m); }
void ImageBox::show() { QVGroupBox::show(); restartMovie(); }