I've already tried VLC library but the cpu reach 100% usage frequently during file playing, I've also the necessity to track the state of the playing so to know when the file is ended etc., Any ideas?
You might experience better performance using
Omxplayer is a video player specifically made for the Raspberry Pi's GPU made by Edgar (gimli) Hucek from the XBMC/Kodi project. It relies on the OpenMAX hardware acceleration API, which is the Broadcom's VideoCore officially supported API for GPU video/audio processing.
If you're using Raspbian,
omxplayer will already be installed. To output to HDMI, just run:
omxplayer -o hdmi <filename>
For further information, check the link above or use
man omxplayer to read the manual page.
The Pi Zero uses a BCM2835 SoC, which supports Broadcom's proprietary media acceleration features.
omxplayer can take advantage of this to gain better performance than software-accelerated playback.
To track whether playback has ended, you can use the
os.system() function in Python. Presumably, when playback is complete, the function will return 0 (exit code 0 implies success, generally, on Unix systems). The call is synchronous so your script will wait until playback is complete until moving to the next line.