Ios video playing

I have to port a video application with seamless switch of the videos to an ipad pro. is this possible with of for ios?

which codecs can I use?

Hi, you could.
In theory, make 2 videoplayers. when one is playing, load the other one on a different thread. Once load is done switch the player that’s being drawn to the newly loaded one. Stop the other one.

There is some code in Apples ObjC examples that actually does this same thing, but with a single player. But it is Objective-C. If you are comfortable with ObjC and there is no other need for using OF I’d recommend you to go for OBJC.


I have no idea of ObjC, though I will try OF.

why should I use threads, I will stop one video and then start the next…

what is the prefered codec on ios for this task.

You use a different thread for loading a video because otherwise it will halt the currently played video. Loading the video is not instant as the app has to read the file and figure out the codec and stuff, although it is very little time it need. If running the both players on the same thread and one loads while the other one is playing, the loading might take more time than a single frame being displayed on the playing player, hence this player will not get it’s frame updated on time which will make it look ugly and not seamless. While on different threads each task runs on parallel without bothering each other.
Look at there might be an addon for this task.

As of the codec, h264 tends to be the most used one. Try different qualities and sizes. Start with this one. If you need better performance, there’s the HAP video codec and player (there’s an addon for using it) which seems to be much better and faster than h264 but I haven’t tried it on iOS.

hope this helps.

thanxs, perhaps I can “jump” inside one clip when the keyframes distance is one.

Sorry, I dont understand.
The problem is not about when to switch from one clip to the other.
If both video players are pre loaded and you will not change their source file, then you can just stop one and start the other one, which should be seamless. This will happen only and if only both players have been loaded previously. Other wise it should be done using threads as said before.

can I rewind the video?

I tried the moviePlayerExample, first I commented the AVplayer code out and actually I am using only the ofxiOSVideoplayer. ( Ok, I dind’t understand the VideoPlayerControl stuff… )