Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Access File Path Returned From Plugin.AudioRecorder #1

Closed
FlammableFork opened this issue Oct 17, 2017 · 1 comment
Closed
Assignees
Labels

Comments

@FlammableFork
Copy link

FlammableFork commented Oct 17, 2017

I am using both of your plugins for Bing Speech (Xamarin.Cognitive.BingSpeech and Plugin.AudioRecorder). They have been working very well. I have just gotten around to testing this plugin (Xamarin.Cognitive.BingSpeech) with UWP, and I have run into a bit of a problem (or mismatch) between this plugin and Plugin.AudioRecorder.

The result from Plugin.AudioRecorder's StartRecording method is the full path to the recorded file. This works well, and recording has no issues. However, when I try to pass that same path to the SpeechToTextSimple method of this plugin, I run into a problem. Plugin.AudioRecorder records to a temporary directory, which for UWP is the TempState folder. however, after looking through the code for this plugin, I can see that things are configured to use LocalStorage, which for UWP is LocalState. This results in an exception being thrown by SpeechToTextSimple in the form of PCLStorage.Exceptions.FileNotFoundException.

The lines of code to which I am referring are lines 222 & 223 in BingSpeechApiClient.cs

var root = FileSystem.Current.LocalStorage;
var file = await root.GetFileAsync (audioFilePath);

This problem doesn't affect iOS or Android, but I am assuming that the temporary storage used by Plugin.AudioRecorder and LocalStorage actually end up being the same directory (I haven't looked into it).

Would it be possible to modify this code to accept a full path using PCLStorage's GetFileFromPathAsync method instead of simply looking for the filename in LocalStorage? The only other option I can see would be to get the file in TempState using PCLStorage and move it to LocalState before sending the request to SpeechToTextSimple. Am I seeing things correctly? Thanks.

EDIT: Or, perhaps even an overload that takes an optional boolean specifying we are sending a full path (to keep the existing API intact)?

@NateRickard NateRickard self-assigned this Oct 19, 2017
@NateRickard
Copy link
Owner

@FlammableFork I knew not creating the UWP sample would come back to haunt me. Fixed the issue and added a UWP sample to the repo. Thanks for reporting & investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants