I needed video recording in running scene in Android games.I am using the help of Android Kamcord plugin but the recording was not done.I didn't get any idea so Please help me.
I am using the unity version 4.2.2 & android device is samsung galaxy note 3.Please find below code.
Code is:
using UnityEngine;
using System.Collections;
public class VideoRecord : MonoBehaviour
{
public GameObject KamcordPrefab;
public GameObject KamcordGO;
public GameObject PlayBtn;
public GameObject PauseBtn;
public GameObject StopBtn;
public GameObject Stop_ShadowBtn;
public bool IsPlaying = false;
public UILabel Check;
public UILabel KamCheck;
// Use this for initialization
void Start ()
{
if( KamcordGO == null )
KamcordGO = (GameObject)Instantiate(KamcordPrefab,this.gameObject.transform.position,this.gameObject.transform.rotation);
Kamcord.WhitelistAllBoards();
}
// Update is called once per frame
void Update ()
{
if(IsPlaying)
{
if(!GameObject.Find("***").animation.isPlaying)
{
Debug.Log(" *** KamCord Stops the Recording *** ");
Kamcord.StopRecording();
IsPlaying = false;
// *** Animation & Audio is Completed then it comes to Default Buttons.
PlayBtn.SetActive(true);
StopBtn.SetActive(true);
PauseBtn.SetActive(false);
Stop_ShadowBtn.SetActive(false);
}
}
if(GameObject.Find("***").audio.isPlaying)
{
Debug.Log("*** Audio is Playing **** ");
}
if(Kamcord.IsRecording())
{
Check.text = "RECORDING ...";
Debug.Log(" *** Is Recording.. *** ");
}
else
{
Check.text = "NOT RECORDING...";
Debug.Log(" *** Not Recording.. *** ");
}
}
void Play()
{
Debug.Log(" *** Play Button Clicked *** ");
GameObject.Find("***").animation["***"].speed = 1;
GameObject.Find("***").animation.Play();
GameObject.Find("***").audio.Play();
IsPlaying = true;
Kamcord.StartRecording();
if(Kamcord.IsRecording())
{
Debug.Log(" *** Is Recording *** ");
}
else
{
Debug.Log(" *** Not Recording *** ");
}
PauseBtn.SetActive(true);
PlayBtn.SetActive(false);
Stop_ShadowBtn.SetActive(true);
StopBtn.SetActive(false);
}
void Pause()
{
Debug.Log(" *** Pause Button Clicked *** ");
GameObject.Find("***").animation["***"].speed = 0;
GameObject.Find("***").audio.Pause();
Kamcord.Pause();
PlayBtn.SetActive(true);
PauseBtn.SetActive(false);
StopBtn.SetActive(true);
Stop_ShadowBtn.SetActive(false);
}
void Stop()
{
Debug.Log(" *** Stop Button Clicked *** ");
GameObject.Find("***").animation["***"].time=0.0F;
GameObject.Find("***").animation.Sample();
GameObject.Find("***").animation["***"].enabled = false;
GameObject.Find("***").audio.Stop();
Kamcord.StopRecording();
//GameObject.Find("***").audio.Stop();
PlayBtn.SetActive(true);
PauseBtn.SetActive(false);
StopBtn.SetActive(true);
Stop_ShadowBtn.SetActive(false);
}
}
I believe we're currently communicating via email. We received your email to [email protected] and have responded. Please check your inbox!