Downloading From Recolude
Much like uploading to Recolude, the easiest way of getting started is by acquiring an instance of a RecoludeConfig. Once you have an instance to a config, you can call LoadRecording to build yourself an ILoadRecordingOperation. This is an abstract command meant to encapsulate the HTTP download request, allowing developers to easily run the fetch asynchronously in something like a Coroutine.
Once you have the command, you can then run it by calling it's Run method. It's advised you yield to this inside a coroutine as this is an asynchronous web request. You can check if anything went wrong by seeing if the Error method returns anything. If it doesn't then congratulations, you just downloaded a recording from Recolude!
You can now view the recording you just pulled down by building a playback from it. To learn more about this checkout the Playback Quick Start Guide.
Example
using UnityEngine;
using Recolude.API;
using Recolude.Core.Playback;
using System.Collections;
public class DownloadExample : MonoBehaviour
{
[SerializeField]
private RecoludeConfig config;
void Start()
{
StartCoroutine(ExampleDownload("c9bf45dc-0f47-4b0d-b9a5-fe4b87ce4096"));
}
IEnumerator ExampleDownload(string recordingID)
{
var req = config.LoadRecording(recordingID);
yield return req.Run();
// Log if an error occurred
if (req.Error() != null)
{
Debug.LogError(req.Error());
yield break;
}
// Play the recording we just downloaded
var playback = PlaybackBehavior.Build(req.Recording()).Play();
}
}