我正在开发Windows Phone 8.1应用程序。此应用程序的工作是记录屏幕活动并将mp4文件存储在存储中。我没有得到任何编译时错误。但
var screenCapture = ScreenCapture.GetForCurrentView();
行返回我UnauthorizedAccessException。我已经为Microphone和Webcam添加了清单文件的功能。我也尝试在页面构造函数和单独的类中调用此代码。我在Windows Phone 8.1操作系统中使用HTC 8x设备
以下是我的代码块:
async private void Button_Tapped(object sender, TappedRoutedEventArgs e)
{
var screenCapture = ScreenCapture.GetForCurrentView();
mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync(new MediaCaptureInitializationSettings
{
VideoSource = screenCapture.VideoSource,
AudioSource = screenCapture.AudioSource,
});
var file = await KnownFolders.VideosLibrary.CreateFileAsync("screenrecording.mp4", CreationCollisionOption.ReplaceExisting);
await mediaCapture.StartRecordToStorageFileAsync(MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto), file);
//sr.StartRecording();}
我提到了这个:http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642093.aspx 我也读过这个:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8840d597-34ad-497f-9a5b-ea1cab6057f9/unauthorizedaccessexception-with-windowsmediacapturescreencapturegetforcurrentview?forum=winappswithcsharp
答案 0 :(得分:1)
您还需要检查访问视频库的功能。
希望这有帮助!