locked
DirectX and XAML Interop with Media Engine

    Question

  • Hello,

    I'm trying to write an app that is a video player with the Media Engine sample as a base with XAML UI overlaying the video. Currently I've got a project with the base of the media engine implemented, and XAML components, however when I go to play a video, all I get is a black screen with the audio of the video file playing the background. I've looked at the DirectX/XAML sample (target practice) and I've set the overlay page to be a SwapChainBackgroundPanel, and set it to transparent as the sample did, but I'm still not getting the overlay that I want. Is there something that I'm doing wrong?

    If anyone needs me to be more in depth or supply some code samples I'd be happy to do that, but maybe someone has a thought based on my description.

    Thanks!

    Wednesday, April 25, 2012 7:57 PM

Answers

  • Hello again Jesse,

    I apologize, I wasn't setting my swap chain correctly. I went through the Target Practice sample again, and read this link (http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx) more closely, and I've figured it out!

    Thanks for your help!

    • Marked as answer by DLAlex Thursday, April 26, 2012 2:49 PM
    Thursday, April 26, 2012 2:49 PM

All replies

  • Hello,

    Would you please provide us some same codes to reproduce this issue?

    You can upload your project to
    http://skydrive.live.com/

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

    Also you can try this sample codes
    http://code.msdn.microsoft.com/windowsapps/Media-Engine-Playback-ce1c82f0

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 26, 2012 6:47 AM
  • Hi Jesse,

    The sample you provided is the sample I was talking about in my initial post. I'm using that sample and trying to have a front end of XAML over top of the Media Engine.

    Similarily to the 3D Target Shooting Game, I use the App.xaml.cpp and App.xaml.h to do a lot of my initialization.

    In the MediaEngine sample the media engine is initialized using this code:

    auto view = ref new VideoView(); view->Initialize(m_window, m_applicationView); view->Run();

    I've modified this code to try and mirror the target shooting game by putting this code in the App::OnLaunched() method:

    m_videoView->Initialize( Windows::UI::Xaml::Window::Current->CoreWindow );
    m_videoView->Run();

    I've modified the Initialize() method and taken out the application view, as it was not being referenced at all, or even being set to anything in the sample (was this a mistake on my part? I'm not using it), and I've modified the Run() method by taking out the infinite loop, and adding the line that was in the infinite loop to the App::OnRendering() method.

    void App::OnRendering( _In_ Object^ sender, _In_ Object^ args ) {
        m_videoView->GetWindow()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); 	
    }

    I've also modified the code for selecting videos because I do not want a picker to pop up. For this I've just changed the OpenFile() method slightly adding this line of code, replacing the code that opens the FilePicker:

    StorageFolder^ installedLocation = Windows::ApplicationModel::Package::Current->InstalledLocation;
    m_pickFileTask = task<StorageFile^>(installedLocation->GetFileAsync(filePath), m_tcs.get_token());

    Other than that, I'm just sending everything else through the VideoView and MEPlayer classes just as the sample does.

    Hopefully this will be helpful to letting me know what is going on with my problem. Just to clarify again.

    • My code plays the video just doesn't render it (I can hear the sound)
    • Renders just a black screen (occasionally renders the first frame of the video)
    • Using MEPlaybackNative sample, as well as Simple3DGameXaml sample

    I appreciate the help Jesse.

    Thursday, April 26, 2012 12:28 PM
  • Hello again Jesse,

    I apologize, I wasn't setting my swap chain correctly. I went through the Target Practice sample again, and read this link (http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx) more closely, and I've figured it out!

    Thanks for your help!

    • Marked as answer by DLAlex Thursday, April 26, 2012 2:49 PM
    Thursday, April 26, 2012 2:49 PM