Flutter - How do I play ambient sounds? - audio

I am developing a flutter app. I want to let the user select some sounds.
When selected, I want the app to play its mp3 file in the assets folder. I tried with AudioPlayer plugin but I haven't achieved to play local files...
I have been searching for awhile and I haven't found any good answer to my questions, furthermore, the posts were created 2 or 1 year ago, so maybe we need an updated answer.
I have found this post: How to play local mp3 file with audioplayer plugin in Flutter
but my project doesn't find this package import 'package:path_provider/path_provider.dart'; [THIS PART IS SOLVED]
And when flutter will have a built-in audio manager? Are they/you working on it?
Thanks in advance!
EDIT: Also, I would like to play different mp3 at the same time, with different volume. Is it possible?

That import directive you see tells Dart that a particular source file uses classes from a different source file. The package: prefix tells Dart that the imported file is part of an external dependency. So you need to tell your project that you have a dependency. This is done in the pubspec.yaml file.
Dart's pub dependency manager takes care of finding the right version of the dependency for you, and downloading it. Add the path_provider package to your pubspec.yaml file. Each package's installing tab shows how to do this.
You can find a whole library of useful flutter (and Dart) packages here.
path_provider is a special type of package called a plugin which contains some Dart code together with iOS and Android specific code. This is necessary because playing audio or creating local files is platform specific.

Related

Unable to remove references to UIWebView from IOS Builds. (Xcode 11.5, Swift 5)

Warning! I am beginner.
Apple testflight is refusing to accept any builds of a previously healthy project, sending out this message;
*
TMS-90809: Deprecated API Usage - New apps that use UIWebView are no
longer accepted. Instead, use WKWebView for improved security and
reliability. Learn more
OK, I understand that the UIWebView is now fully deprecated and no longer allowed.
I have scoured all the files in may app manually using the Xcode editor and find there is no reference to the deprecated string ( UIWebView ) in any file that I can edit.
Using the Xcode "find in project" tool also says it's not there.
If I build & archive, then run grep in CLI to examine the resulting package contents, the report is that the string "UIWebView" IS found in the app and the dSYM file.
Also, again using grep, I have examined the various framework files referenced in the editor, the report is that framework 'UIKIT' contains many references to UIWebView. The check does not reveal any other references to the string.
UIKIT is still shown as required in the build list.
I have cleaned the project, deleted all derived data, closed and opened the project and xcode.
Could any kind soul point me in the right direction here - I am stumped.
Thanks, Max
After learning a lot more, I found it was the PayPal external framework which had deprecated references in it. They no longer maintain it. I had to remove that and I added Braintree instead which is kept updated.
I had failed to check the external frameworks when trying to sanitise the cause. There is no magic bullet here...I just had to plod through all the components.
This was mostly caused by my inexperience and failure to understand the function of the various components of an app.

Changes after last 6.10.0-r19i.8185 BixbyStudio

I have issues after last update of BixbyStudio to version 6.10.0-r19i.8185 after submission as public or private:
When using simuator (or device) Im getting an error message: Missing a mock for Installed Apps. Add "appId": "com.samsung.android.bixby.service" and "appVersion": "1" to the apps.json file. For more info: https://bixbydevelopers.com/dev/docs/dev-guide/developers/ide.simulator#mock-installed-apps. When I go to this url there is no any inforation about this apps.json. Do you have information where I can put this file and can read more about it?
I have capsule with audio:
capsule {
id (my.app)
version (0.4.0)
format (3)
targets {
target (bixby-mobile-en-US)
}
capsule-imports {
import (bixby.audioPlayer) {
version (0.3.1)
as (audioPlayer)
}
}
}
which generates from that BixbyStudio for me deprecation warning
import '0.3.1-bixby.audioPlayer' does not declare itself as 'library' and will not be importable in the future, but im using same version from that document https://bixbydevelopers.com/dev/docs/sample-capsules/samples/audio
Please explain what is wrong here
Thanks a lot for your answers!
Support for testing audio library in Simulator is not available yet. However, you should be able to test the same on an actual device.
The next iteration of Simulator is expected to support audio.bixbyPlayer in a couple of weeks from now.
Re: import '0.3.1-bixby.audioPlayer' does not declare itself as 'library' and will not be importable in the future, you can ignore this warning for now.
Using audio player with simulator is a feature not yet available, but on-device testing should work. This new feature will be included in future release. However, I cannot confirm a definitive date.
No mocking in IDE is supported at the moment, this is a feature not yet available. There is NO way to invoke audio player or any other installed apps in simulator.
To confirm the audio player feature is working correctly on device. Please download example.meow and do private submission (you may need to change namespace) on your device. This is a large repository, the example.meow capsule is in subfolder audio. After confirming example.meow is working correctly, you can follow the syntax as an example in your capsule.
Good news! With the new 19I release and version (0.3.2), we finally got rid of the warning. And so is many other library capsules, please update your IDE and use the new version published here.
I'm also seeing this error also and can't find any information about where this file should be placed.
Missing a mock for Installed Apps. Add "appId": "com.samsung.android.bixby.service" and "appVersion": "1" to the apps.json file.

How to remove AdMob completely from Android Studio project?

Probably I'm asking a too much simple question but I didn't find any exact answer by googling.
In my android studio project, How to remove AdMob completely?
Well, the dependency for Google's Mobile Ads SDK is usually play-services-ads or firebase-ads if you're using Firebase. I'd remove whichever one of those is present in your build.gradle file's dependencies section, and then remove any references from your Java/Kotlin files that no longer resolve.
Well, when you download the library it might happen that it creates an exception or it is not implemented properly or not downloaded properly in this condition it is better to remove them completely.
You can search for "edit library and dependency.." inside that you will find a lot of liberals and the one which you want delete you can select it and press delete key.

Missing libraries/modules from Perfect framework on Linux

I am a newbie learning how to code in Swift on Linux.
Right now I am trying to use Perfect framework so I can create th REST service (or something like that) I am following instructions in this
https://videos.raywenderlich.com/courses/77-server-side-swift-with-perfect/lessons/1
video (I have found a link on perfect.org site) and I did everything just like in the video, but the problem occurs when I have to edit the main.swift file and use include to use the PerfectLib, PerfectHTTP and PerfectHTTPServer libraries/modules(?). When I run it the error shows on the terminal saying:
main.swift:1:8: error: no such module 'PerfectHTTP'
import PerfectHTTP
Same with other modules. Do I have to place downloaded files from Perfect to some special directory within swift directory? Or maybe the files in download link are not complete?
before doing any Server Side Swift, please temporarily forget Xcode and try a new tool chain called Swift Package Manager. Open a terminal in a blank folder and type swift package init then it will setup a blank project which contains a Package.swift, a folder named Sources and a Tests directory as well.
Now you have to edit the Package.swift before import anything into your source code. For example, the starter template Perfect server has such a Package.swift:
import PackageDescription
let package = Package(
name: "PerfectTemplate",
targets: [],
dependencies: [
.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 2)
]
)
Then you can import any Perfect libraries included in the Perfect-HTTPServer.git
Here is the importing part as defined in the main.swift of PerfectTemplate:
import PerfectLib
import PerfectHTTP
import PerfectHTTPServer
So I will suggest that the best practice is to try Perfect Assistant: https://assistant.perfect.org/perfectassistant/Perfect%20Assistant.dmg which can save most tricky operations such as dependency management, building on linux and production server deployment.
For more information about Perfect other than tutorial video, see this link: http://www.perfect.org/docs/

I am having difficulty getting a new version of a 3rd party SDK to import into Android Studio

I am having difficulty getting a new version of a 3rd party SDK to import into Android Studio.
In the earlier version they released .jar and .so files which I copied into /lib and /jniLibs and then added the lib files into the Android Studio app and everything worked. The app ran, used the libraries and all was good in the world. Recently a new version of this SDK was released but in this new release they have resource files (but they are not compiled into the jar/so files; there is a $Rstring.class files that they say I should import. I've now spent days copying into various locations in the app project with no luck and the missing strings result in crashes when calling their SDK.
OK, I figure I'd try to import their SDK folder (which is how they document to do it if you are using Eclipse). Well, no matter what I've tried and after selecting the folder or SDK's project file I get a dialog asking for the Eclipse workspace and a list of what appears to be source file names. I can't get past this dialog because obviously I don't have their files.
Has anyone run into this and found a solution; perhaps I'm missing something in the process but after spending the better part of 3-4 days trying and searching and trying more things I'm hopeful for help from the community.
OK, I found the answer and it was a combination of issues in how this particular 3rd party distributed the SDK and not fully understanding the menu.
The 3rd party in question packaged the SDK with the output files of the build as well as files that needed to be imported making an import alone to not work.
Combine this with menu confusion: File->Import Module is NOT the same as New->Modules->Import Existing Project only added to the confusion.
The solution ended up being to use the File->Import Module which appears to be a very different operation and once done most of the issues where solved. It solved the main issues I asked above which was missing resourced.
Still missing was the library (.jar) files which had to me copied into the app's lib folder and "added as library" but the .SO files did not need to be copied and in fact doing that resulted in a duplicate files warning.
I'm not sure I can fully explain what happened but what I think happened is that the "module" was where the app read the .so and string resources from but was unable to load the .jar files because (I suspect) these files where not part of the module but rather where outputs of building the source and it was removing the source files which caused the inability of the new->Module->Import to fail.
Hopefully this makes sense or at least give someone an idea of what to look for when/if they run into a similar issue.

Resources