Click here to Skip to main content
15,884,838 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I have a requirement to play a video continuously using mplayer. I am using Qt 4.7 in a Linux environment. For this, I have taken playvideo function as below.

C++
void Widget::playvideo()
{
   ret = system("mplayer /path/to/video.avi");
   qDebug()<<"ret="<<ret;
   playvideo();
}


From one button click, I am calling this playvideo function. After system call, I am calling again playvideo function. Here playvideo function is calling without finishing video but my requirement is to call playvideo function after finishing video playing. I am unable to achieving this. Can you please help me how to solve this.

What I have tried:

C++
void Widget::playvideo()
{
   ret = system("mplayer /path/to/video.avi");
   qDebug()<<"ret="<<ret;
   playvideo();
}
Posted
Updated 23-Jul-19 22:18pm
v2
Comments
Peter_in_2780 24-Jul-19 2:33am    
Have you tried "mplayer -loop 0 /path/to/video" ?
According to the docs, -loop 0 will loop that video forever.
Stopping it is a different issue.
Member 13740197 24-Jul-19 6:21am    
Thanks for the answer. When I used this -loop 0 working fine but after sometime I am getting below error. I am using linux POS device, below is uname -a output
Linux companyname 3.0.35-2666-gbdde708 #43 PREEMPT Sat May 19 10:11:22 IST 2018 armv7l GNU/Linux


Can you please help how to resolve this error.

Error:
[AO OSS] Can't set audio device /dev/dsp to s16le output, trying s16le...
[AO OSS] Can't set audio device /dev/dsp to s16le output, trying s16le...
[AO OSS] Can't set audio device /dev/dsp to s16le output, trying s16le...
[AO OSS] Can't set audio device /dev/dsp to s16le output, trying s16le...

MPlayer interrupted by signal 2 in module: ao2_init
Can't restore text mode: Invalid argument


Peter_in_2780 24-Jul-19 8:03am    
Sorry, I can't help with that. You might do better in a forum related to your hardware and linux.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900