Problems opening VLC and Running another def

Asked

Viewed 15 times

0

Guys I’m creating a system that will talk and listen to the user, basically it runs a video and the guy has to answer (a quiz)

QObject::~QObject: Timers cannot be stopped from another thread

Follow the code part:

 for i in range(0, questions):
    _playVideo('voice', ('video_0' + str(i)))
    _record(i)

Basically the following occurs: When the user starts the app.py he will run a video with a question, and he has to answer, as soon as he gives the answer (by voice) he opens the second question and so on until the last...

Someone’s been through it??

NOTE: I’m using Raspberry PI 3 I don’t know if it influences anything

  • Only with what you put in the question will it be impossible to understand the problem. Do you need to make the application listen to the user even while running the video? Did you use threads for that? If so, how did you do it? If not, could you detail the problem better? What are the implementations of the functions _playVideo and _record?

  • Anderson, it turned out that I’ve already managed to solve rsrs, but responding to his wig, not he only listens to the user after the video is over, I’m using Google’s Speechrecognition to listen to the user on _record

  • @Wallacebruno If you managed to solve the question, post the answer so that people who come here later know how it was done and try to replicate if it is in their interest. The purpose of SOPT is precisely to leave the record of how things are done here, yet another solution like yours that seems very interesting.

1 answer

0

Follow the solution I found to run 1 video at a time as per user’s speech:

Below has a function called _play() that plays the audio files:

def _playVideo(file):
    os.system('vlc /home/pi/bot/audio/voice/' + file + '.mp4 -f --quiet')

This "file" is passed as per the user’s request (using Watson it passes the intention of the Conversation)

The function call is made on top of the number of questions we have (in case they are 18) so it was like this:

questions = 18
for i in range(1, questions):
  if (i = 1):
    _playVideo(str(1))
  else:
    _play(conversation_return)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.