Intelligent mirror design based on Dragonboard 410c (4) - how to retrieve video messages and play display

I introduced you to how to automatically retrieve the text message of the specified user, and use the html template to automatically play the text message on the qt control. However, in the smart mirror, we can also push the video message to the specified user and display the video in real time. The news, here to further introduce how to achieve automatic retrieval and playback of video messages on the magic mirror based on the dragonboard 410c.

Similar to retrieving a text message, the path of the video message is saved in the pushInfo table in the smart mirror database we built. If the field in the table is infoType==1, it is a video message, and this time in the pushInfo table. The filePath will record the specific address of the video, which can be either the cloud or the local video path, and can be supported. Also in the video message, the fields isTop and viewWight still play their role, which can control the playback of the video. Sequence and whether to play, if isTop is 1 means that the video will play preferentially. If isTop of multiple video messages is 1, then it will be sorted according to chronological order. If viewWight is 0, the message has been played and is no longer played, according to the above rules. This article builds the getTextMessageList(self,userID) function in the database class to complete the retrieval of the video message of the specified user. The specific implementation code is as follows:

Def getUserVideoMessageList(self,userID):
Format="select pushID,filePath from pushInfo where ownerID==%u and isTop==1 and infoType==1 order by pushTIme desc"
Values=(userID)
querySQL1=format % values
Self.cu.execute(querySQL1)
Result1=self.cu.fetchone()
#print result
Format="select pushID,filePath,pushTIme from pushInfo where ownerID=%u and isTop==0 and infoType==1 order by pushTIme desc"
Values=(userID)
querySQL2=format % values
Self.cu.execute(querySQL2)
Result2=self.cu.fetchone()
If result1!=None and result2 != None:
#result=result1+result2
Return result1+result2
Elif result1==None and result2!=None:
#result=result2
Return result2
Elif result1!=None and result2 == None:
#resutl=result1
Return result1
Else:
#result==None
Return None

In the above code, the ID of the message will be returned: infoID, and the video path: filePath will be returned in the form of a list. After the user obtains the list, the video player can be called to load the video list and play it. Here we use mplayer video playback. To realize the video playback, the specific usage and control method of the player can refer to the content of the blog I used to write the video using mplayer on the 410c board. Here we directly upload the code, the specific playback is as follows :

#show message end get video message info
If videoMsgList!=None:
Print("start play video msg")
i=0
For videoMsg in videoMsgList:
If i%2==0:
Print(videoMsg)
self.push_video_userID.append(videoMsg)
Else:
Print(videoMsg)
self.videoPathList.append(videoMsg)
i=i+1
Videocmd="mplayer -vo x11 -playlist "
For video in self.videoPathList:
Videocmd=videocmd+' '+video
Os.system(videocmd)

This code is integrated into the text message display code segment, and the video can be automatically played in order after the text message is loaded. At the same time, the text message can also be played back in the loop, and the video will automatically exit after the video is played. .

Here we have realized the core functions of the message display and video playback of the smart mirror. We will further introduce how to integrate the face recognition technology introduced before, get the user ID through face detection, and then according to ID completes the user's video, text message retrieval, display and playback.

Waterproof Airline Plugs

Waterproof Airline Plugs,Flat Wire Aviation Plug,Nylon Injection Molded Nut Aviation Plug,Waterproof Aviation Plug For Led Luminaire

Shenzhen HuaTao Electronic Co., LTD , https://www.htconnector.com

This entry was posted in on