Supported Microsoft Media Foundation APIs for Windows Phone 8

July 21, 2014

The following sections list the Microsoft Media Foundation (MF) interfaces and methods that are supported on Windows Phone 8. For information on developing Windows Phone apps using MF, see Walkthrough: Using Microsoft Media Foundation for Windows Phone 8.

This topic contains the following sections.

IMFMediaEngine interface

Create an instance of the IMFMediaEngine interface by calling IMFMediaEngineClassFactory::CreateInstance.

There are two differences between the phone and desktop implementations of IMFMediaEngineClassFactory::CreateInstance.

  • On the phone, the IMFMediaEngine only supports frame-server mode. Attempting to initialize the interface in either rendering mode or audio mode will fail.

  • On the desktop, the MF_MEDIA_ENGINE_DXGI_MANAGER initialization attribute is used to specify that hardware acceleration should be used for video decoding and video processing. On the phone, hardware acceleration is always used, when possible.

Supported methods

Methods of this interface that are not in the following list cannot be used in Windows Phone 8 apps.

Method

Description

GetCurrentSource

Gets the URL of the current media resource, or an empty string if no media resource is present.

GetCurrentTime

Gets the current playback position.

GetDuration

Gets the duration of the media resource.

GetError

Gets the most recent error status.

GetLoop

Queries whether the Media Engine will loop playback.

GetMuted

Queries whether the audio is muted.

GetNativeVideoSize

Gets the size of the video frame, adjusted for aspect ratio.

GetReadyState

Gets the ready state, which indicates whether the current media resource can be rendered.

Note:
On Windows Phone 8, this method will only return MF_MEDIA_ENGINE_READY_HAVE_NOTHING or MF_MEDIA_ENGINE_READY_HAVE_ENOUGH_DATA.

GetVideoAspectRatio

Gets the picture aspect ratio of the video stream.

GetVolume

Gets the audio volume level.

HasAudio

Queries whether the current media resource contains an audio stream.

HasVideo

Queries whether the current media resource contains a video stream.

IsEnded

Queries whether playback has ended.

IsPaused

Queries whether playback is currently paused.

IsSeeking

Queries whether the Media Engine is currently seeking to a new playback position.

OnVideoStreamTick

Queries the Media Engine to find out whether a new video frame is ready.

Pause

Pauses playback.

Play

Starts playback.

SetCurrentTime

Seeks to a new playback position.

SetLoop

Specifies whether the Media Engine loops playback.

SetMuted

Mutes or unmutes the audio.

SetSource

Sets the URL of a media resource.

SetVolume

Sets the audio volume level.

Shutdown

Shuts down the Media Engine and releases the resources it is using.

TransferVideoFrame

Copies the current video frame to a DXGI surface or WIC bitmap.

Note:
Windows Imaging Component (WIC) is not supported on Windows Phone 8, so frames must be copied to a DXGI surface. Also, on the phone TransferVideoFrame may occasionally return E_FAIL when you’re seeking in the video stream (using SetCurrentTime) or when changing video streams. Your app should simply ignore this error call the method again when the next frame is available.

IMFMediaEngineEx interface

Supported methods

Methods of this interface that are not in the following list cannot be used in Windows Phone 8 apps.

Method

Description

GetBalance

Gets the audio balance.

SetBalance

Sets the audio balance.

SetSourceFromByteStream

Opens a media resource from a byte stream.

IMFMediaEngineClassFactory interface

Before using this interface, call CoInitializeEx. To get a pointer to this interface, call CoCreateInstanceFromApp using the class identifier CLSID_MFMediaEngineClassFactory.

Supported methods

Methods of this interface that are not in the following list cannot be used in Windows Phone 8 apps.

Method

Description

CreateInstance

Creates a new instance of the Media Engine.

IMFMediaError interface

Get a pointer to this interface by calling IMFMediaEngine::GetError.

Supported Methods

Methods of this interface that are not in the following list cannot be used in Windows Phone 8 apps.

Method

Description

GetErrorCode

Gets the error code.

GetExtendedErrorCode

Gets the extended error code.