这是一个非常简单的功能,可以返回包含内部视频的视图。
工作正常,但我想添加本机iOS媒体控件,如播放,暂停,底部进度,视频的全屏按钮,就像下面的图像一样。有什么建议吗?
private UIView createVideo(Page p, int ndx)
{
UIView v = new UIView(new CoreGraphics.CGRect(p.elements[ndx].left * app.scale, p.elements[ndx].top * app.scale, p.elements[ndx].width * app.scale, p.elements[ndx].height * app.scale));
AVPlayer _player;
AVPlayerLayer _playerLayer;
AVAsset _asset;
AVPlayerItem _playerItem;
_asset = AVAsset.FromUrl(NSUrl.FromFilename("videos/" + p.elements[ndx].file));
_playerItem = new AVPlayerItem(_asset);
_player = new AVPlayer(_playerItem);
_playerLayer = AVPlayerLayer.FromPlayer(_player);
_playerLayer.Frame = new CoreGraphics.CGRect(0, 0, p.elements[ndx].width * app.scale, p.elements[ndx].height * app.scale);
v.Layer.AddSublayer(_playerLayer);
return v;
}