Hello,
This is an extra question from How can I add a video view to my iOS .NET project? - Microsoft Q&A
the problem is that the video is not removed from screen after the video has played until the end.
Please refer to the following code:
protected override void LoadContent()
{
...
gameController.PresentViewController(PlayerViewController, true, () =>
{
player.Play();
});
NSNotificationCenter.DefaultCenter.AddObserver(new NSString("AVPlayerItemDidPlayToEndTimeNotification"), (notification) =>
{
PlayerViewController.DismissViewController(true,null);// add observer to catch the ending event
}, PlayerViewController.Player.CurrentItem);
}
In addition, how can I play a video from my iOS project instead of a video from an url? Can I add a video file to my iOS project and play it with AVPlayer?
Yes, you can do this. For your new question, it would be best if you try to open up a new thread for it. In this way, it will make answer searching in the forum easier and be beneficial to other community members as well. And you can attach the new thread link here, we can work together to figure it out.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.