Hello,
I have a RPI app working to produce a Video Wall App, and to make it work, I use ofVideoPlayer::setPosition. However, I have found that when I called that method frequently (every minute) it freezes after a few minutes. Calling it every 15 minutes results in it lasting a few hours, but it still freezes. If I call the method less frequently than every 15 minutes, I can get it to play for a half a day, but then the videos playing in multiple wall devices get out of sync in the video wall. Here are snippets of my code:
void ofApp::update(){
...
for (int i = 0; i < playingPres.zones.size(); ++i){
...
if (!zoneGetNextItem[i]){
if (videoZoneIndex == i){
if (videoZoneInUse){ //
if (isVideoZoneVideoWall){
if (updateVideoWall && videoZone->isLoaded()){
float videoDuration = videoZone->getDuration();
float pos = getCalculatedPositionForWallVideo(i, videoDuration);
videoZone->setPosition(pos);
updateVideoWall = false;
videoZone->update();
printOutMemoryUsage("VideoWallUpdate");
continue;
}
else{
videoZone->update();
continue;
}
}
else if (videoZone->getIsMovieDone()){
videoZone->close();
videoZoneInUse = false;
delete videoZone;
videoZone = nullptr;
zoneGetNextItem[i] = true;
}
else{
videoZone->update();
continue;
}
}
}
if (SecondChanged){
if (0 == zoneSecondCounters[i] || 0 >= --zoneSecondCounters[i]){
zoneGetNextItem[i] = true;
}
}
continue;
}
else{
++zoneItemIndexes[i];
if (zoneItemIndexes[i] >= playingPres.zones[i].mediaItems.size()){
zoneItemIndexes[i] = 0;
}
}
if (videoZoneIndex == i){
if (isVideoZoneVideoWall){
int mediaIndex = 0; //only one video in MediaItems List for Video Wall
if (mediaIndex < playingPres.zones[i].mediaItems.size()){
MediaItem media = playingPres.zones[i].mediaItems[mediaIndex];
if (isUrlInDownloadedUrlSet(media.src)){
if (videoZone != nullptr){
videoZone->stop();
videoZone->close();
delete videoZone;
videoZone = nullptr;
}
videoZone = new ofVideoPlayer();
videoZoneInUse = true;
videoZone->load(media.getDownloadedPath());
videoZone->setLoopState(OF_LOOP_NORMAL);
zoneGetNextItem[i] = false;
zoneSecondCounters[i] = 0;
float videoDuration = videoZone->getDuration();
float pos = getCalculatedPositionForWallVideo(i, videoDuration); //pos = 0 ... < duration
videoZone->setPosition(pos);
videoZone->play();
videoZone->update();
updateVideoWall = true;
printOutMemoryUsage("VideoWallStart");
}
}
continue;
}
}
The video type I am using is an mp4. I have other video files, but I believe I would get the same results. Is there some method I am missing in the code above? Am I supposed to set a format or some setting in the ofVideoPlayer class?
Any good help would be really appreciated