// Not an actual test... just examples
        public void FactoryMethods()
        {
            // Sample: FactoryMethods
            RecognitionAudio audio1 = RecognitionAudio.FromFile("Sound/SpeechSample.flac");
            RecognitionAudio audio2 = RecognitionAudio.FetchFromUri("https://.../HostedSpeech.flac");
            RecognitionAudio audio3 = RecognitionAudio.FromStorageUri("gs://my-bucket/my-file");

            byte[]           bytes  = ReadAudioData(); // For example, from a database
            RecognitionAudio audio4 = RecognitionAudio.FromBytes(bytes);

            using (Stream stream = OpenAudioStream()) // Any regular .NET stream
            {
                RecognitionAudio audio5 = RecognitionAudio.FromStream(stream);
            }
            // End sample
        }
示例#2
0
        public void FetchFromUri_Uri()
        {
            var audio = RecognitionAudio.FetchFromUri(new Uri(IconUri));

            Assert.Equal(IconContentSize, audio.Content.Length);
        }