How do I determine if MediaElement is playing?

前端 未结 8 2258
闹比i
闹比i 2021-01-01 09:44

Seems simple enough, but I cannot figure out any way to determine what the state of a MediaElement is. There are various properties for some states (such as IsBuffering) but

8条回答
  •  醉话见心
    2021-01-01 10:16

    What I did to "work around" that was subclass MediaPlayer (this would work for MediaElement as well) and add my own methods to Play/Pause/Stop. In those methods, I maintain a field which represents the playback status. Also, you need to hook MediaEnded so that you can change the status from 'playing' to 'stopped.'

提交回复
热议问题