IMFPMediaPlayer (Microsoft Media Foundation)

MChulek 1 Reputation point
2020-10-21T09:02:19.807+00:00

Dear All,

I am currently involved with the application of a video playback application using the Microsoft Media Foundation.

The Media Foundation API requires the usage of the header mfplay.h.
More info can be found here: https://video2.skills-academy.com/en-us/windows/win32/api/_mf/

The mfplay.h has 3 interfaces:

  1. IMFPMediaItem Represents a media item. (Deprecated.).
  2. IMFPMediaPlayer Contains methods to play media files. (Deprecated.).
  3. IMFPMediaPlayerCallback Callback interface for the IMFPMediaPlayer interface.
    More info can be found here: https://video2.skills-academy.com/en-us/windows/win32/api/mfplay/

Microsoft Provides 2 playback examples based on IMFPMediaPlayerCallback:

  1. MFPlayer2 (from 07/02/2020)
    https://video2.skills-academy.com/en-us/samples/microsoft/windows-classic-samples/mfplayer2/
  2. SimplePlay (from 06/11/2020)
    https://video2.skills-academy.com/en-us/samples/microsoft/windows-classic-samples/simpleplay-sample/

However, in the IMFPMediaPlayerCallback appears to be deprecated (according to following link) and MediaSession should be used instead (from 12/05/2018):
https://video2.skills-academy.com/en-us/windows/win32/api/mfplay/nn-mfplay-imfpmediaplayercallback

A whole description of how to implement video playback using MediaSession is described here (from 05/31/2018):
https://video2.skills-academy.com/en-us/windows/win32/medfound/how-to-play-unprotected-media-files

My question is:
Should I develop my application based on the use of IMFPMediaPlayerCallback or Media Session?

Kind Regards,

Marcelo

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,613 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Rita Han - MSFT 2,161 Reputation points
    2020-10-21T09:33:25.723+00:00

    Hello @MChulek ,

    From official sample repo in GitHub: MFPlayer2 Sample and SimplePlay sample, both published 5 years ago. You can ignore the time difference between these two samples.

    Since the document states that IMFPMediaPlayerCallback is deprecated and may be removed from future releases of Windows. It is suggested to use the Media Session for playback instead.

    Thank you!


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Castorix31 85,131 Reputation points
    2020-10-21T10:12:00.027+00:00

    A more recent interface is IMFMediaEngine

    0 comments No comments

  3. Roman R 331 Reputation points
    2020-11-03T16:31:44.277+00:00

    Should I develop my application based on the use of IMFPMediaPlayerCallback or Media Session?

    IMFPMediaPlayer is deprecated, I would rather you not use it, it's clearly unreliable.

    IMFMediaSession Media Session API is okay and is the primary Media Foundation API to control pipelines. Good choice unless you need UWP support (where you don't have Media Session part of Media Foundation API).

    IMFMediaEngine mentioned above is a wrapper over Media Session API. Makes things easier at the cost of flexibility. Good for simple straightforward things.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.