Periksa Audio Bermain di Windows Python

import asyncio, winrt.windows.media.control as wmc

def mediaIs(state):
    session = asyncio.run(getMediaSession())
    if session == None:
        return False
    return int(wmc.GlobalSystemMediaTransportControlsSessionPlaybackStatus[state]) == session.get_playback_info().playback_status #get media state enum and compare to current main media session state
Famous Ferret