locked
Screen recording in windows phone 8.1

    Question

  • I am working on an windows phone 8.1 application. Work of this app is to record screen activities and store mp4 file in storage. I do not get any compile time error. But

    var screenCapture = ScreenCapture.GetForCurrentView();
    

    line returns me UnauthorizedAccessException. I have already added capabilities for Microphone and Webcam to manifest file. I have also tried calling this code in page constructor and from separate class. I am using HTC 8x device with Windows Phone 8.1 OS

    Following is my code block :

    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();}
    


    Monday, December 1, 2014 2:07 PM

Answers

  • Hello,

    I think what is happening is that your app made a security demand for access to the video resources and the user answered "no" to allow access. Subsequent calls to the ScreenCapture API would cause an access violation error as you describe. Removing your app and redeploying to the device should display the security demand again and allow you to answer appropriately.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, December 1, 2014 11:55 PM
    Moderator

All replies

  • Hello,

    I think what is happening is that your app made a security demand for access to the video resources and the user answered "no" to allow access. Subsequent calls to the ScreenCapture API would cause an access violation error as you describe. Removing your app and redeploying to the device should display the security demand again and allow you to answer appropriately.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, December 1, 2014 11:55 PM
    Moderator
  • Thanks James :) Its working.
    Tuesday, December 2, 2014 8:52 AM
  • Hi,

    Me too I started developing a screen recorder app since a lot of months. The problem is that you meet a lot of crazy unauthorized access. At the end you can't control the switch between the recording and the exit from the app. :(

    Sunday, December 7, 2014 8:31 PM
  • Hi,

    Me too I started developing a screen recorder app since a lot of months. The problem is that you meet a lot of crazy unauthorized access. At the end you can't control the switch between the recording and the exit from the app. :(

    I am studying how to build this same tool for windows phone, yet not exists application to record the device screen video, can help me to starting it?
    • Proposed as answer by Amna Syed Friday, May 29, 2015 12:57 PM
    • Unproposed as answer by Amna Syed Friday, May 29, 2015 12:57 PM
    Wednesday, January 7, 2015 5:19 PM
  • Hi,
    I can help you for developing screen recording application but this only works fine if you want to record the screen activities within your application.

    I am working on screen recording application since one week.i want to run this recording while the application is running in the background.but i did not find the solution till now.

    Can anyone help me to solve this problem???

    u can approach me through this email: syeda22amna@gmail.com

    Thank you!
    Amna Syed


    • Edited by Amna Syed Friday, May 29, 2015 12:57 PM
    Friday, May 29, 2015 12:53 PM
  • For security reasons we only allow your app to record its own display. You cannot capture the screen when your app is in the background.

    -James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Tuesday, June 2, 2015 10:58 PM
    Moderator