Consider the following minimal working example using mpylayer:
import mpylayer
mp = mpylayer.MPlayerControl()
files = ['/tmp/video1.mp4','/tmp/video2.mp4']
for i in range (0,2):
mp.loadfile(files[i])
This should play all of the video1.mp4
and after that it should open video2.mp4
and play this. However there are two problems:
- It doesn't play all of the
video1.mp4
it just opens it for a second and then closes it. - After closing
video2.mp4
there is a delay of a few seconds until it begins playingvideo2.mp4
So how can I fix both problems?
Edit:
To fix the first problem I tried to use time.sleep(mp.length)
i.e.
import mpylayer
import time
mp = mpylayer.MPlayerControl()
files = ['/tmp/video1.mp4','/tmp/video2.mp4']
for i in range (0,2):
mp.loadfile(files[i])
time.sleep(mp.length)
This works for the case that I don't pause the video, seek forward or backward or close it. So there must be a better solution.