Capture screen and audio with objective-c - objective-c

I'm using an AVCaptureSession to create a screen recording (OSX), but i'd also like to add the computer audio to it (not the microphone, but anything that's playing through the speakers) i'm not really sure how to do that so the first thing i tried was adding an audio device like so:
AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
After adding this device the audio was recorded, but it sounded like it was captured through the microphone. Is it possible to actually capture the computer's output sound this way? like quicktime does.

Here's an open source framework that supposedly makes it as easy to capture speaker output as it is a screenshot.
https://github.com/pje/WavTap
The home page for WavTap does mention that it requires kernel extension signing privileges to run under MacOS 10.10 & newer, and that requires signing into your Apple Developer Account and submitting this form. More information can be found here.

Related

How to send a texture with Agora Video SDK for Unity

I'm using the package Agora Video SDK for Unity and I have followed these two tutorials:
https://www.agora.io/en/blog/agora-video-sdk-for-unity-quick-start-programming-guide/
https://docs.agora.io/en/Video/screensharing_unity?platform=Unity
Up to here, it is working fine. The problem is that instead os sharing my screen, I want to send a texture. To do so, I'm loading a png picture and trying to set it to the mTexture you find in the second link. It seems to be working on my computer, but it is like it doesn't arrive to the target computer.
How can I send a texture properly?
Thanks
did you copy every line of the code from the example as is? You may not want to do the ReadPixel part since this reads the screen. You may just read the raw data from your input texture and send it with the PushVideoFrame every update.

Screen record with sound - AVFoundation? Desktop Mac

I was trying to create two things. Both for desktop mac. Both which involve recording screen/audio.
In first thing, which is my main priority right now, I am making a song identifier. The second thing, is a screen capture (with audio) thing.
I was thinking of using AVFoundation. I don't see any sound recording capabilities though, just playing - https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/index.html#//apple_ref/doc/uid/TP40008067
Is it possbile to record system audio somehow?
Thanks
I've used this document in the past to figure out the live screen recording part. https://developer.apple.com/library/mac/qa/qa1740/_index.html
You'll probably also find the code snipped in the AVCaptureSession overview useful.
The gist of it is that AVCaptureSession is the object that controls all your inputs and outputs for the given capture session. In this case it would be AVCaptureScreenInput and I believe for audio you want AVCaptureDeviceInput of type audio. There is a way to get the list of all the available devices for a AVCaptureDevice of a specific type. Then you add AVCaptureMovieFileOutput to your session output.
I know that's a little high level, but that technical Q&A as well as looking into getting particular input types should help.

Playing DRM songs

I have an audio tag like this:
<audio id="myAudio" msaudiocategory="BackgroundCapableMedia"></audio>
to which I set the src property to
URL.createObjectURL(file, { oneTimeOnly: true });
and then call
myAudio.play();
This works well for my personal mp3's, but songs downloaded through the Xbox Music Pass, which I assume are under DRM, simply do not play. There's no audio and the 'timeupdate' event never fires. I don't see any exception or message in the Output window.
I tried playing those same songs with VLC, and I get no audio while the progress bar advances normally.
Is it possible to play those songs outside of the official apps?
Edit: and if it isn't, can we detect if a music file is DRM'ed so as to prevent its usage in our apps?
These are DRM'd files, so they need the DRM keys, etc etc.
Since those are private to the application, it's not possible to play that DRM'd content outside of those applications.

Can I play flash video file on iPad?

I want to make simple project which play flash video file from online.
I've searched some articles and read carefully.
But I can't understand, how to play flash video files on iPad by Code.
So I need help from you.
Please.
Simply put, without being jailbroken, No you cannot.
The closest thing to being able to view flash in iOS is Frash, and I am not even sure if it is actively being developed or supported any more.
You can always check out the open source project for Frash. by Comex.
All IOS devices don´t support Flash player, but is be possible to use a Javascript or HTML5 player for video.
No, iWhatever's currently do not and to the best of my surfing knowledge, have no intention of supporting flash format due to some argument between apple and adobe.
At the end of the day, the Flash video format is a container for a movie that’s been compressed by some codec. If you can get to the source file, you know the format of the container, you know the codec that was used to encode the video, and you know how to write code to convert that into audio streams and video frames, then yes, you can play Flash videos on the iPad.
So, to recap:
Get the Flash video file.
Get to the encoded video data in the Flash file.
Decode the video and convert it, either into raw audio and video or to another format that the iPad can play.
Play the result of #3.
Needless to say, this is quite the endeavor. It’s better to download the movies to your desktop and convert them there before loading them into your application.
Yes you can! The question is whether or not you can play the video itself not whether or not ipads support flash player.
the answer is this.. new versions of "flash video" have a f4v file extension. These videos are basically a h.264 mp4 files. You "may" be able to play it in an ipad simply by renaming it to .mp4
If that doesn't work then use a utility like Miro to convert your "flash video" to a format that your ipad will accept. http://www.mirovideoconverter.com/

Audio recorded is echoing in mac app using Apple Sample

I need to implement audio recording feature in my mac app.i am using the Apple sample
http://developer.apple.com/library/mac/#samplecode/AudioDataOutputToAudioUnit/Listings/main_m.html. Everything is working fine .The only issue is that the audio file created is echoing while playing.Please help!Later I checked, Apple sample also has the same problem
From the description of the sample code:
The built application uses a QTCaptureSession with a QTCaptureDecompressedAudioOutput to capture audio from the default system input device, applies an effect to that audio using a simple effect AudioUnit, and writes the modified audio to a file using the CoreAudio ExtAudioFile API.
From CaptureSessionController.m:
/* Create an effect audio unit to add an effect to the audio before it is written to a file. */
OSStatus err = noErr;
AudioComponentDescription effectAudioUnitComponentDescription;
effectAudioUnitComponentDescription.componentType = kAudioUnitType_Effect;
effectAudioUnitComponentDescription.componentSubType = kAudioUnitSubType_Delay;
It looks like this delay is intentional, as part of the demo.
Well I found the answer myself.Just need to comment
effectAudioUnitComponentDescription.componentSubType = kAudioUnitSubType_Delay;
From CaptureSessionController.m: