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
Related
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.
As per my title, i am searching any code for playing sound when my device is in silent mode. I am searching from 3days but in ios 8 and later no code is working for silent mode.
Any help would be appreciated. Please pass me any suggestion and advice as soon as possible.
Thanks
You can use AVPlayer for play file sound and set:
let session = AVAudioSession.sharedInstance()
try! session.setCategory(AVAudioSessionCategoryPlayback)
try! session.setActive(true)
You can check my example code here:Sample
noob here.
I am developing an app for windows phone that streams audio from the web. I've put the play function with MediaElement class, and i have no problem with it.
Then, i want to add a feature to get/record the audio that i stream. I've googling and didn't find what i want.
Is there a way to do that?
Regards,
BM
This is the Microphone class link which can be used to capture audi.
Give a try and let me know
Microphone to capture audio
also go nthrough this link
capturing and playing audio
I'm implementing a game for WP7, and I need that a mp3 file plays in background, while I navigate through some screens. How can I do this? Thanks in advance.
Use background Audio agent for this purpose to play , even when user navigate between pages.
Also you can achieve the continuous playback by 2 ways
1. set the repeat option to play continuously
or
2. start play back again upon receiving the stop message, this can be achieved by putting code for starting playback again in Application Background player state handler upon receiving "PlayState.Stopped" message.
Please refer this link "How to: Play Background Audio for Windows Phone" for more details.
Hm.. what about global MediaPLayer instance?
See this link
I am trying to make a simple application which will store the sound said by user , say on click of record button and will play it back to him/her , say on click of play button.
Can anyone suggest me some appropriate way to do this ??
Thanks,
Miraaj
You can use QuickTime Kit's capture APIs to record a movie of the audio, and QTMovie (from the same framework) to convert it to a more conventional format for audio files and to play back both the intermediate file and the converted file.
There used to be a QuickTime Kit Programming Guide, but it didn't cover capturing and is now gone from developer.apple.com. You should file a bug against the docs.
This answer will work in a Cocoa (Mac) app. If you meant to ask about the iPhone, you should re-tag your question, as the solution will be completely different for a Cocoa app vs. a Cocoa Touch (iPhone) app.
I used direct sound to create an entire internet phone application a few years ago. Your question is far simpler, you won't have to deal with the circular buffer as critically. Direct sound is pretty main stream and you can find a lot of help with it in forums, and it's free!