Start a new topic

Recording and screenshot code

I am trying to use WikitudeCamera and Natcorder to record the device screen to be able to record the AR experience as well. I am stuck and would appreciate some help here.

NatCorder has just one article but I am not able to understand how to connect it with Wikitude - https://medium.com/@olokobayusuf/natcorder-unity-recording-made-easy-f0fdee0b5055


Moreover I am also facing trouble with taking screenshot and saving it in the device's gallery. It seems like it is not saving at all as I am unable to view the screenshot in the gallery. I tried using this plugin - https://github.com/yasirkula/UnityNativeCamera



Hi,


Please provide the following details:


  • Which version of the SDK are you using?
  • Are you using any of our Extensions (Cordova, Xamarin, Unity)? If yes, which version are you using?
  • What Unity version are you using?
  • What OS does this happen with (iOS, Android, UWP)?
  • Is this happening with the sample app or in your own app? If it happens with your own app, Does the sample app work on your device?


If you integrate our SDK with a thirdparty software like e.g. NatCorder, we might not be able to provide support or details for this, as our team might not have knowledge for the tool in question.


Thx and greetings

Nicola

this is what i tried


 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Wikitude;
using NatCorderU;
using NatCorderU.Core.Clocks;
using NatCorderU.Core;
using System;
using System.IO;

public class CameraControllerScript : MonoBehaviour
{
   
    private Texture2D _cameraFeed;
    public bool takingScreenshot = false;
    // Start is called before the first frame update
    void Start()
    {
        NativeCamera.Permission myPermission = NativeCamera.CheckPermission();
        NativeCamera.RequestPermission();
        if(myPermission.Equals(NativeCamera.Permission.Denied)){
            NativeCamera.RequestPermission();
        }
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void TakePicture()
    {
        StartCoroutine(CaptureScreenshot());

    }

    private IEnumerator CaptureScreenshot(){
        takingScreenshot = true;
		yield return new WaitForEndOfFrame ();
		
        _cameraFeed = new Texture2D (Screen.width, Screen.height, TextureFormat.RGB24,false);
		_cameraFeed.ReadPixels(new Rect(0,0,Screen.width,Screen.height),0,0);
        _cameraFeed.Apply();
        
        string path = string.Format("{0}_Capture{1}_{2}.png",Application.productName,"{0}",System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
        NativeGallery.SaveImageToGallery(path,Application.productName + "Captures",path);
        takingScreenshot = false;
    }
}

 


Login or Signup to post a comment