【发布时间】:2019-06-18 12:51:11
【问题描述】:
我正在处理xamarin.forms 共享项目。我在将视频设置为启动画面时遇到问题。我从here 得到了参考。
我面临的问题是视频播放器已初始化并执行其过程,此时,AppDelegate 代码首先返回。所以视频没有显示,但它的声音来了。有什么我想念的吗?
在这里我合并了样本的VideoController 和VideoViewController。我只使用 VideoViewController 并在 SetMoviePlayer() 函数中的 Resources 文件夹中引用我的视频
我试过的代码:
AppDelegate.cs
[Register("AppDelegate")]
public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override UIWindow Window { get; set; }
VideoViewController control = new VideoViewController();
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
try
{
Window = new UIWindow(UIScreen.MainScreen.Bounds);
Window.RootViewController = control;
//global::Xamarin.Forms.Forms.Init();
//LoadApplication(new App());
//control.VideoCompletionEvent += Control_VideoCompletionEvent; // Tried to invoke this on video completion but doesn't help. AppDelegate returns value first then this event is invoked.
Task.Delay(7000).Wait(); // video is 7 seconds long
}
catch (Exception ex)
{
Console.WriteLine("======== "+ex.Message);
}
Window.RootViewController = null;
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return true;
}
//private bool Control_VideoCompletionEvent()
//{
// //Window.RootViewController = null;
// //global::Xamarin.Forms.Forms.Init();
// //LoadApplication(new App());
// //return true;
//}
}
VideoViewController 和 VideoCutter 文件与上面链接中的相同。
谢谢
【问题讨论】:
标签: xamarin.forms xamarin.ios avplayer splash-screen