Why tmediaplayer.CurrentTime not working for Android? - firemonkey

I want to make control audio with tackBar
I use this code
When audio is playing, my code on timer is
If trackbar1.max<>mediaplayer1.duration then
trackbar1.max := mediaplayer1.duration;
If trackbar1.value<>mediaplayer1.currentTime then
trackbar1.value :=mediaplayer1.currentTime
This code works perfectly for windows, but on Android no (trackbar keep changing up down up down)

It's a bug (RSP-19678).
You may get fix from this repository.

Related

Audio problems in nativescript app on iOS

I have a nativescript-app that uses text-to-speech functionality (#nativescript-community/texttospeech).
This is working fine so far.
Now, I open a modal-view with the #nstudio/camera-plus plugin that enables the user to capture a photo.
After closing the camera-view, the audio of the text-to-speech is only half as loud as before.
Is the camera messing up the audio-settings? And if so, how can I avoid that?
Nativescript 8.1
texttospeech 3.0.3
camera-plus 4.0.3
Didn't find the cause for this, but at least a workaround.
I put this above every audio-related task:
AVAudioSession.sharedInstance().setCategoryWithOptionsError( AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategoryOptions.DefaultToSpeaker);
That sets the volume back to full.

Xamarin MediaMager notifications on Android

I use the following code to start playing a local audio file. To my disappointment, no notification is shown on my Android emulator. After some digging, I notice that the Android MediaNotificationManager has all the code commented out.
I can see from a few other on GitHub, that other people does seem to have notifications (ironically, a few people seem to have problems getting rid of them - Example), so what do I need in order to get it?
IMediaFile mediaFile = new MediaFile(playRequest.Path, MediaFileType.Audio, ResourceAvailability.Local);
mediaFile = await CrossMediaManager.Current.MediaExtractor.ExtractMediaInfo(mediaFile);
await CrossMediaManager.Current.Play(mediaFile);
CrossMediaManager.Current.MediaNotificationManager.StartNotification(mediaFile);
CrossMediaManager.Current.MediaNotificationManager.UpdateNotifications(mediaFile, MediaPlayerStatus.Playing);
I found a reason. Notifications on Android require an Icon. By inspecting the source code of MediaNotificationManager, I found that on Android it actually handles notifications in a completely other class: MediaNotificationManagerImplementation found in MediaSession.
There, I also learned that it will look for an icon of type Android.Graphics.Bitmap in the property Art on the metadata. Curiously, the property ArtUri is not used for anything.
If this property is null, it will look for a drawable in resources, with the name xam_mediamanager_notify_ic. If none is found, it will use the application icon.
Now, this solves all my needs for Android. However, it's handled quite differently on other platforms, and I've yet to find out how to set the art on UWP (and I've not tested iOS yet).

iOS app only plays sounds through headphones

The iPhone I'm using for development only outputs sounds through the headphones for all the apps I'm running from xcode. Other apps (like Youtube or iTunes) play sound just fine, and also building and testing the very same apps on a different device (an iPad) works perfectly. Running the apps in simulator also works as intended.
I'm using:
Xcode 6 (working in Swift 1.2)
AVFoundation library and AVAudioPlayer
iPhone 6 Plus (with iOS 8.4.1)
the phone is not in silent mode
Any tips or hints would be appreciated. Thanks
Sometimes the audio route can get a bit messed up.
You should listen to the audio route changes using the AVAudioSessionRouteChangeNotification
See HandlingAudioHardwareRouteChanges
You can also force the audio route if needed. Working with Audio Input and Output Routes
Oh, and also check the reason for the change to know why its happening on that app. AVAudioSessionRouteChangeReason

Audio not working in YouTube player helper app

I'm writing an app that plays videos from YouTube using the YouTube helper library ( https://developers.google.com/youtube/v3/guides/ios_youtube_helper#controlling_playback ).
The video works well, but when it plays there is no audio. I am new to using audio in apps, so it is quite possible that there is a very simple setting that I need to change in my xcode project, but I don't know what it is. Any help is greatly appreciated.
It turns out that my phone was simply on silent. YTPlayerView cannot produce any sound when the ring/silent switch is in the silent position
Actually you can make the YTPlayerView reproduce sound even with the switch in the silent position: Check this answer
To play Youtube even when in silent mode, add the following to your code. Can be anywhere, like in AppDelegate:
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
}
catch {
// report for an error
}
Original code copied from here
YoutubePlayer cannot produce any sound when the ring/silent switch is in the silent position and sound will be active

Update media_player.js for Default/Styled media receiver

Is there a way to manually update the version of media_player.js that the Default or Styled media receiver is using?
It appears that it is using v0.3, however, there are a few issues regarding HLS playback that seem to have been fixed with v0.5+. I have confirmed the fixes using media_player.js v0.5, but would like to use the Styled Media receiver for my application.
Thanks for bringing that to our attention. We'll update that soon and will try to keep that updated moving forward, that has fallen through the cracks unfortunately.
To answer your original question, there is no way for you to do that :-(

Resources