playMaker

Author Topic: Record and Playback Video  (Read 4339 times)

kidwithacomputer

  • Playmaker Newbie
  • *
  • Posts: 18
Record and Playback Video
« on: May 07, 2014, 02:34:43 PM »
Hello again!

I am searching for a way to record video with the front facing camera on iPad. I'd like to then use those videos as textures. My ultimate goal is to create a simplified version of an app like VidRhythm, where short video clips playback to create some music:
Are there any actions out there that handle video in this way?

Thank you!

Edit 05/08/14: After a bunch of attempts at searching I found this old post where Jean saved the day again :) http://hutonggames.com/playmakerforum/index.php?topic=1613.0

I tried plugging in isFrontFacing into the script to toggle to the front camera, however with my still beginner scripting skills I haven't had any luck getting this to work. I'll give it another try in the morning.

I've also been looking at the AVPro Movie Capture plugin but I'm not sure if this does what I'm after either. I'll investigate more and report back. Just wanted to share where I was at for now. Cheers.

Edit 05/11/14: It took me a few days to figure out how to get this to work, but I successfully (kind of) merged this code with Jean's to get the front facing camera working on iPad. I still don't know what I'm doing but if this helps anyone here's what I have so far:

Code: [Select]
import System;
import HutongGames.PlayMaker;

@ActionCategory("Webcamera")
@Tooltip("Streams video from the installed Webcamera(s)")
public class playWebcamera extends FsmStateAction{

   @UIHint(UIHint.Variable)
public var gameobject : FsmOwnerDefault;

public var deviceId : FsmInt;

@UIHint(UIHint.Variable)
@ObjectTypeAttribute(typeof(WebCamTexture))
public var webCamTexture : FsmObject;

public var success : FsmEvent;
public var failure : FsmEvent;

public function Reset(){
gameobject = null;
deviceId = null;
webCamTexture = null;

success = null;
failure = null;
}

public function OnEnter(){
var devices : WebCamDevice[] = WebCamTexture.devices;

var frontCamName: String;
var backCamName: String;
var frontTex: WebCamTexture;
var backTex: WebCamTexture;

for( var i = 0 ; i < devices.length ; i++ ) {
  if (devices[i].isFrontFacing) {
    frontCamName = devices[i].name;
  } else {
    backCamName = devices[i].name;
  }
}

frontTex = new WebCamTexture(frontCamName, 400, 300, 60);
backTex = new WebCamTexture(backCamName, 400, 300, 60);

var go : GameObject = Fsm.GetOwnerDefaultTarget(gameobject);

if (go != null && frontTex !=null) {
go.renderer.material.mainTexture = frontTex;
frontTex.Play();
  Fsm.Event(success);
  webCamTexture.Value = frontTex;
}

else{
Fsm.Event(failure);
}
}   
}

I will update with my journey on trying to get it to record and playback in the coming days, possibly with just a bunch of swear words. :P
« Last Edit: May 12, 2014, 01:15:01 AM by kidwithacomputer »

kidwithacomputer

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Record and Playback Video
« Reply #1 on: May 15, 2014, 07:49:14 PM »
The time has come for me to admit defeat. This stuff is beyond my tiny mind's abilities. If anyone has any suggestions in the future please do share.

Me after trying to figure this out all week -->  :o