Vintage
Vintage

Reputation: 238

How to check whether mplayer plays a file or not?

I am trying to check if mplayer is playing an mp3 file. I currently use this line from python

strace -p " + str(mplayer.pid) + " 2>&1 | head -n 200 | grep 'read(3'

That is because I know that mplayer makes system calls when reading file from descriptor number 3. However, no matter how many lines I analyze, there is not a single reading operation.

Upvotes: 3

Views: 891

Answers (1)

Barry Staes
Barry Staes

Reputation: 4125

I only know of one reliable way to determining whether MPlayer is playing something, and that is by running it as slave and reading its ASCII pipe continuously.

Watching text occurrences in that pipe of media data not found, Failed to open or STARTING PLAYBACK and whether the process has quit (it is done playing).

Upvotes: 0

Related Questions