Hi, I have some code from here (Using Windows MediaElement to play local Video) to work with the mediaElement in c++. It works and allows me to play a video full screen. I would like some advice on how to position it correctly within m_panel (so I can get it to fit in at a given position) within my scene. Also how to implement the callback and stop/pause etc. As this is for a real project I would be happy to pay real money!
Any interest?
Thanks. Katie.
Can you not add a Scene
or Layer
m_panel
and call setPosition()
?
On what ? Here is the code I have so far. I think m_panel is like the openGLView shared panel. Are you suggesting I create a new OpenGLView and position it within my scene? I’m a bit out of my depth so any help would be great
void TVModal::initSprites() {
const std::string &url = "ms-appx:///mov_bbb.mp4";
auto dispatcher = cocos2d::GLViewImpl::sharedOpenGLView()->getDispatcher();
m_panel = cocos2d::GLViewImpl::sharedOpenGLView()->getPanel();
if (dispatcher->GetType() && m_panel->GetType()) {
dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, url]() {
double height = m_panel->ActualHeight;
double width = m_panel->ActualWidth;
auto mediaElement = ref new Windows::UI::Xaml::Controls::MediaElement();
Windows::Foundation::Uri^ uri = ref new Windows::Foundation::Uri("ms-appx:///mov_bbb.mp4");
mediaElement->Source = uri;
mediaElement->AutoPlay = true;
mediaElement->IsFullWindow = false;
mediaElement->Name = "Intro";
mediaElement->IsMuted = false;
m_panel->Children->Append(mediaElement);
log("play");
}));
}
}