This object does not have that much to do with Direct3D, but it is provided anyway. This uses Microsoft Media Foundation to play media, so any format limitations etc. apply. This is also a relatively resource intensive object so you might want to consider using some other library for your sound effects.
Because Media is asynchronous you might encounter some surprises. For example when starting to play a media this might happen:
>>> media = d3d11.Media("somefile.mp3", None) >>> media.hasAudio() False >>> #Wait... >>> media.hasAudio() True >>> #Audio has "magically" appeared.
This is because Media does not know what kind of streams it will get until they have been processed. Also attempting to set media position etc. can fail if all streams are not yet initialized. XXX Write abot events.
Creates a new Media.
Returns the duration of the media as a reference time.
Returns all events that have occurred. There is usually no need to call this method, these events are sent to the parent window and received from d3d11.Window.getMessages(). This is useful if you are using some third party windowing toolkit.
Returns the current play position as a reference time.
Returns the current video image as a Texture. If no video is available an exception is raised. This is very slow, so don’t attempt to do any real-time operations with this. The width and height of the texture will be the width and height of the output area.
Returns the native video size.
Returns the current volume as a normalized float. Can be from 0.0 (silent) to 1.0 (maximum).
Returns True if the Media currently has an audio stream.
Returns True if the Media currently has a video stream.
Pauses the media.
Starts playing the media.
Sets playback position. This also starts to play the media.
Sets media volume.