Hi,
I have to embed a video from my resources in a UIView.
So in first I add my video to my resources folder and put his build action to "content".
My video is in MP4 format.
Then I created this func which is call in ViewDidLoad.
`void Video()
{
string fileName = "Resources/Movies/menu.mp4";
string locallUrl = Path.Combine(NSBundle.MainBundle.BundlePath, fileName);
NSUrl url = NSUrl.FromFilename("menu.mp4");
_player = new MPMoviePlayerController(url);
_player.View.Frame = VideoView.Bounds;
VideoView.AddSubview(_player.View);
_player.ControlStyle = MPMovieControlStyle.None;
_player.PrepareToPlay();
}`
And then I called _player.Play() in ViewDidAppear.
But nothing happen.
I think i missed something but I don't know what.
Thank's in advance,
Regards,
Anthony
Answers
Did you check the size of that _player.View frame? Perhaps it's set to zero so you don't see anything. Other option is looking at MPMoviePlayerController logs. If it's not playing it should throw some errors
Thank's for your answer, but the frame is not set to zero.
For the second option, how can I get some logs for the MPMoviePlayerController? because I have nothing in the application output...
I notice that your filename variable is set two different ways. That may be it. If you have the .mp4 in the
Resources/
folder, you should be able to load it with theNSUrl.FromFilename( Path.Combine (...
technique. I have attached a solution that demonstrates the technique.