Play custom audio - audio

I'm trying to play an mp3 I will bundle with my app. I added it in the assets, just like the images, added to the pubspec, but can't make it play.
I tried two libraries, rxlabz/audioplayer and evrone/flutter_audio (medrecorder_audio), to no avail.
The first I tryed configuring to isLocal: true, added every conceivable callback, but it just returned the error:
Attempt to call getDuration without a valid mediaplayer
Which I couldn't relate to flutter/dart but found is a common error on Android, related to not calling prepare method. I checked their code, though, and they seem to be calling. I thought it my be async, so I waited a while after creating the player to call start, no luck.
The latter just gives the error "startPlay: FAIL" when I start play.
It seems these libs are made to play an audio that's on the user's cellphone, but I'm not sure. I want to play my own custom mp3 that I will bundle as an asset. Would someone shed some light?

Thanks to #aziza's link, and a lot of experimenting, I found the problem.
The file to be played need to me an MP3; WAV just won't work, and will give a very cryptic error.
This class shows in details how to do it.

Related

Control Actions-on-Google Media-Response (e.g. start at minute 3)

i want to develop an google-action. (ideally using dialogflow).
but the google-action needs some features where i couldn't find a solution, and i'm not sure if it's even possible.
My Usecases:
The google action starts a mps. someone stops and exits the google action, and if the user starts the google action again, i would resume the mp3.
but i couldn't find a solution where i can determine the "offset", when the user stops the mp3.
and even i would have this offset, i didn't find a solution how to tell google assistant, that i want to play the mp3, but starts at e.g. Minute 51.
I would be really wondered, it the google action possibilitys are so extremly restricted.
can someone confirm, that this usecases are not possible, or can someone give me a hint how to do it?
i only found this one, which is restricted to start a mp3 at beginning.
https://developers.google.com/actions/assistant/responses#media_responses
Kind Regards
Stefan
To start an mp3 file at a certain point you can try the SSML tag and its clipBegin property.
clipBegin - A TimeDesignation that is the offset from the audio source's beginning to start playback from. If this value is greater than or equal to the audio source's actual duration, then no audio is inserted.
https://developers.google.com/actions/reference/ssml
To use this, your mp3 file has to be hosted using HTTPS
Hope that this helps.
You could use the conversational actions (instead of dialogflow) where media responses allow using a start_offset
....
"content": {
"media": {
"start_offset": "2.12345s",
...
For more details see
https://developers.google.com/assistant/conversational/prompts-media#MediaResponseProperties
Even conversational actions seem to be the "newest" technology for google actions. Or at least released recently.

Alexa Skill Static Audio File implementation

I have been playing around with this project from git, and so far so good.
https://github.com/bespoken/streamer
I would like to enhance it to play a long form static audio file when the user asks for it. For example, if the user asks for "Ask Streamer to Play the National Anthem", I would like to just play just that file. Does anyone have a good idea on the best way to implement this simple thing?
I tried a few approaches and I am having trouble getting the end result. For one, I do not want the data of static file to be saved on dynamodb, but still want the podcast information to be saved.
I added an Intent for 'Anthem', and sample utterances for that intent. In the constants.js file, I added a new "STATIC_MODE", and tried to replicate how PLAY_MODE is implemented through out
Here is the issue I am running into, whenever I stop the Anthem file from playing, and later invoke the Podcast Player, it starts playing The Anthem, instead of podcasts.I tried commenting out the saveState in audioEventHandlers.js for the STATIC_MODE handler, yet, when I try to play podcast, it still plays the Anthem when I ask for play podcast.
Any help would be appreciated!
This is probably bad, but I have never coded in javascript, just tried to follow the git project to enhance the functionality to my liking.
I created the Streamer project that you reference. In the interest of providing a simpler example on how to use the Alexa AudioPlayer, I also created this project:
https://github.com/bespoken/super-simple-audio-player
I believe it happens to do exactly what you requested, which is it simply plays a single, static audio file. I created this because I wanted a have a less complicated example to show people how the AudioPlayer works. Hope you find it helpful!

Angular2 not updating/transpiling/compiling correctly

I'm a beginner with this framework and I'm frustrated. I've just about given up on learning Angular2 for now, but can someone please explain to me how I can copy line for line the code in the docs and it still not work?
Earlier on I've seen instances of it calling classes that I've long gotten rid of. I reinstalled everything, upgraded npm to 3.1.0, made sure node is up to date, and tried again. Maybe I shouldn't have taken this unfinished language up when I'm a beginner (no idea how to debug), but I'm speaking of the 'Heroes' tutorial on their site.
The view is supposed to show "Loading..." then get info from the app component. In the beginning, it loads as it should, but then I get to that "Master/Detail" in the tutorial and it all goes to boom boom. Let me show you my code:
Well this is the app component. This code worked at first until I got deeper into the tutorial. I go back to this code, and it doesn't work anymore. What gives? Followed the doc to the 't'
I had to comment out this code because it made the app mysteriously stop working. Stopped when I passed the array in the constant HEROES to the property heroes. Again, this is in the docs.
The index and module files are fine. I've stopped and restarted at least four times and I've about had it. I think I'll just finish learning the regular MEAN stack. Unless someone can come up with a reason why all of this is happening? I see no fault in my code. And even if there was, changing my code or undoing changes should produce results. IT DOESN'T!
I'm thinking it's more to do with the transpiling process, and it not updating TS to JS properly? Which could explain why I was still seeing error messages saying it was trying to call classes I've already gotten rid of.

Are there any resources for react that can replace htlm5 audio tags?

I am currently working on something of a soundcloud clone and for now I'm simply having all the audio files render as html5 audio tags. Are there any nice react equivalents I can npm install to make my audio a wave or appear dynamic? I'm very thankful for any suggestions!!!
In searching online for you, I see a few options available to you.
Here:
https://www.npmjs.com/package/react-audio-player
https://www.npmjs.com/package/react-audio
https://www.npmjs.com/package/react-audio-recorder (might not be as helpful, but worth noting)
https://www.npmjs.com/package/hymn
What exactly are you trying to achieve? These libraries might be helpful depending on the exact details.
This StackOverflow answer shows how to use your own controls to stylize the player however you so desire.

Mono4Android Can't Find axml Resource

I'm trying to do the very basic tutorial on setting up multiple views on the Mono4Android Documentation.
I've had this error for about 3 hours now, and can't seem to figure it out.
I've looked through all the build settings ect but nothing...
Mono keeps coming up with the error : ".Resource.Layout Does not contain a definition for 'Second'"
I have even copied an pasted the whole tutorial, and yet I'm still idle from this pathetic error.
I can dam right tell Mono that there is a definition of Second in the layout resource Folder!
Why doesn't anything want to play ball?
Make sure the build action on the file is set to AndroidResource.

Resources