
<!DOCTYPE html>
<html lang='en-US'>
    <head>
        <!--Document title is project name-->
        <title>NatCorder Scripting Reference on Calligraphy</title>
        <!--Extra information-->
        <meta name='description' content='NatCorder API documentation on Calligraphy'> <!--Populate from Calligraphy-->
        <meta name='keywords' content='NatCorder, Calligraphy, Unity'> <!--Populate from Calligraphy-->
        <meta name='author' content='Calligraphy by Yusuf Olokoba'>
        <meta charset='UTF-8'>
        <!--Style sheet-->
        <link rel='stylesheet' href='../Styles/memberstyles.css'>
    </head>
	
	<body>
        <h1 class='blockname'><a href='../Groups/HEVCRecorder.html'>HEVCRecorder</a>.CommitFrame</h1>
        <p1 class='faintname'>public  void CommitFrame (T[] pixelBuffer, long timestamp)<b>;</b></p1>
        <br>
        <br>
        <h2>Description</h2>
        <p1>Commit a video frame for encoding.<br><br>
            Note that WebGL is an immediate-encode platform, meaning that frames are encoded immediately 
            they are committed. As a result, timestamps on video frames and audio sample buffers are wholly ignored.</p1>
        <br>
        <br>
        
        <!--Code example-->
        <!--Must not be indented-->
        <!--There must be no space between the text and the pre tags-->

<code>
<pre>public class RecordWebCam : MonoBehaviour {

    WebCamTexture cameraTexture;
    IMediaRecorder mediaRecorder;
    IClock clock;
       
    IEnumerator Start () {
        <font color='green'>// Start camera preview</font>
        cameraTexture = new WebCamTexture();
        cameraTexture.Play();
        <font color='green'>// Start recording</font>
        clock = new RealtimeClock();
        mediaRecorder = new ... <font color='green'>// Create a recorder</font>
        <font color='green'>// Wait a while</font>
        yield return new WaitForSeconds(10f);
        <font color='green'>// Stop recording</font>
        mediaRecorder.Dispose();
        mediaRecorder = null;
    }
    
    void Update () {
        if (mediaRecorder != null && cameraTexture.didUpdateThisFrame) {
            <font color='green'>// Commit the frame for encoding</font>
            mediaRecorder.CommitFrame(cameraTexture.GetPixels32(), clock.Timestamp);
        }
    }

}</pre>
</code>
<br>
        
        
        <!--See Also-->
        
        
        <!--Copyright tag-->
        <br>
        <hr>
        <p1 class='copyright'><small>Copyright (c) Yusuf Olokoba 2016</small></p1>
        
	</body>
</html>        
        