/// <summary> /// Check if the required files exist locally. If not, /// download the assets from Azure Storage. /// In a production scenario, you would want to gracefully handle /// situations where we cannot connect to the internet or /// some other issue blocks the downloading of the assets. /// </summary> private async Task DownloadRequiredFiles() { bool requiredFilesExist = CheckIfRequiredFilesExist(); if (!requiredFilesExist) { if (!Directory.Exists(DestinationPath)) { Directory.CreateDirectory(DestinationPath); } await BlobStorageUtilities.DownloadAllBlobsInContainerAsync(blockBlobContainerName, DestinationPath); } DownloadingMusicFilesFinished?.Invoke(); }
private async Task TestDownloadFileAsync() { if (!Directory.Exists(Application.streamingAssetsPath)) { Directory.CreateDirectory(Application.streamingAssetsPath); } const string fileNameToDownload = "Track 1.ogg"; var path = Path.Combine(Application.streamingAssetsPath, fileNameToDownload); if (!File.Exists(path)) { await BlobStorageUtilities.DownloadBlobFromAzureStorageAsync( fileNameToDownload, blockBlobContainerName, Application.streamingAssetsPath); } StartCoroutine(PlayClipFromStreamingAssets(fileNameToDownload)); }