0
我有一個本地.mov文件添加到我的Xamarin項目。我想在Main.storyboard文件中添加的視圖中播放它。View中的MediaPlayer無法播放。 Xamarin iOS
我在做什麼錯?
using Foundation;
using System;
using UIKit;
using MediaPlayer;
namespace XamarinTest
{
public partial class heartbeatPage : UIViewController
{
MPMoviePlayerController moviePlayer;
public heartbeatPage (IntPtr handle) : base (handle)
{
moviePlayer = new MPMoviePlayerController(NSUrl.FromFilename("heartAnimation4.mov"));
moviePlayer.ScalingMode = MPMovieScalingMode.AspectFit;
heartView = moviePlayer.View; //HeartView is a view I added in the storyboard.
moviePlayer.PrepareToPlay();
moviePlayer.Play();
}
}
}
謝謝!我之前已經使用AVPlayer工作,但我只需要在屏幕的一部分上顯示視頻,並在其餘部分顯示文字。 –