Ejemplo n.º 1
0
 internal void CopyArchive(Archive archive)
 {
     this.CreatedAt = archive.CreatedAt;
     this.Duration = archive.Duration;
     this.Id = archive.Id;
     this.Name = archive.Name;
     this.PartnerId = archive.PartnerId;
     this.SessionId = archive.SessionId;
     this.Size = archive.Size;
     this.Status = archive.Status;
     this.Url = archive.Url;
 }
        private void StoreArchiveID(Logger logger, OpenTokSDK.Archive archive)
        {
            var blobName = "openTokArchives";
            List <OpenTokSDK.Archive> archives = new List <OpenTokSDK.Archive>();

            // Get an instance of the blob storage to store the session data
            CloudBlobContainer container = Storage.GetCloudBlobContainer("opentok-container");

            logger.Log("Blob container created if it does not exist: " + container.CreateIfNotExistsAsync().Result.ToString());

            string archiveBlobs = Storage.GetBlob(blobName, "opentok-container");

            if (archiveBlobs.StartsWith('['))
            {
                archives = JsonConvert.DeserializeObject <List <OpenTokSDK.Archive> >(archiveBlobs);
            }
            else if (archiveBlobs.StartsWith('{'))
            {
                archives.Add(JsonConvert.DeserializeObject <OpenTokSDK.Archive>(archiveBlobs));
            }

            if (archives.Where(s => s.Id == archive.Id).Any())
            {
                var archiveJsonFormatted = JsonConvert.SerializeObject(archives.Where(s => s.Id == archive.Id).FirstOrDefault(), Formatting.Indented);
                logger.Log("OpenTok archive already exist: " + archiveJsonFormatted);
            }
            else
            {
                // Add the session to the blobs to be uploaded
                archives.Add(archive);

                logger.Log("OpenTok Archive created with session ID: " + archive.SessionId);
                logger.Log("OpenTok Archive created with archive ID: " + archive.Id);
                logger.Log("OpenTok Archive object: " + JsonConvert.SerializeObject(archive, Formatting.Indented));

                NexmoApi.StoreOpenTokData("opentok-container", logger, JsonConvert.SerializeObject(archives), blobName);
            }
        }
Ejemplo n.º 3
0
 internal void CopyArchive(Archive archive)
 {
     this.CreatedAt = archive.CreatedAt;
     this.Duration = archive.Duration;
     this.Id = archive.Id;
     this.Name = archive.Name;
     this.PartnerId = archive.PartnerId;
     this.SessionId = archive.SessionId;
     this.Size = archive.Size;
     this.Status = archive.Status;
     this.Url = archive.Url;
     this.HasVideo = archive.HasVideo;
     this.HasAudio = archive.HasAudio;
     this.OutputMode = archive.OutputMode;
 }