Audio/ Video capturing In Windows 8 Metro App - directx

I am working On Audio/Video capturing from a Web Camera and this is targeted On Windows 8 Metro Style Not on Desktop Mode.
I planning to Write a Library for this So that any application can use this library to Stream Video.
Windows 8 provides Direct X and Win RT for metro mode of Windows 8. I am bit confused which one to use it for this.
Is Win RT Alone is Sufficient for Detecting Camera and Capturing Audio/Video ?? Does Direct X Involvement is required here?

I found out this on the Internet.So the Win RT Alone is sufficient for this.
http://code.msdn.microsoft.com/Media-Capture-Sample-adf87622.

There are audio/video capture APIs available in WinRT itself, under Windows.Media.Capture namespace. You don't need to go for DirectX. The following C# code records video with sound and saves to the 'Videos' folder of current user.
var settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.AudioAndVideo;
var capture = new MediaCapture();
await capture.InitializeAsync(settings);
var profile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto);
var file = await KnownFolders.VideosLibrary.CreateFileAsync("captured.mp4", CreationCollisionOption.GenerateUniqueName);
await capture.StartRecordToStorageFileAsync(profile, file);
For audio-only capture, use StreamingCaptureMode.Audio and MediaEncodingProfile.CreateM4a()

Related

Detecting Mobile Devices That Can't Stream MP3 - MVC

I am developing an MVC mobile web where I return an audio file depending on the URL parameters.
I want to add a condition where I return mp3 files for smartphones,
and return dm files for old mobile devices that cannot stream mp3 files
Is there a standard procedure that detects old devices or should I loop through all my options?
Check below two links if they are useful
http://www.dotnetglobe.com/2013/04/device-detection-in-aspnet-mvc-4.html
http://techbrij.com/display-mode-mobile-tablet-tv-aspnet-mvc
Update:
get device
$.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
Since there is an undefined list of devices that don't play mp3,
The safest way to do this is to state the devices that do play mp3,
and I'll leave the rest to the Else Clause.
If userAgent.Contains("iphone;") Or
userAgent.Contains("ipad;") Or
userAgent.Contains("symbianos;") Or
userAgent.Contains("ipod;") Or
userAgent.Contains("android;") Or
userAgent.Contains("blackberry;") Or
userAgent.Contains("samsung;") Or
userAgent.Contains("nokia;") Or
userAgent.Contains("sonyericsson;") Or
userAgent.Contains("symbian;") Then
Device = Modes.SmartPhone
Else
Device = Modes.OtherPhone
End If

How to play a sound in a Firefox Mobile extension?

I am writing an extension for Firefox Mobile (Fennec) which should play a sound. Using nsISound, i.e.
var sound = ios.newURI(pathToSoundFile, null, null);
var player = Components.classes["#mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
player.play(sound);
works fine on the Desktop version of Firefox, it but wouldn't produce any sound on FF Mobile. I also tried appending an audio element to the website,
var audioElement = win.content.document.createElement('audio');
audioElement.setAttribute('id','audio_test');
audioElement.setAttribute('src',pathToSoundFile);
win.content.document.body.appendChild(audioElement);
win.content.document.getElementById('audio_test').play();
which works, but only if the website is stored locally on my computer (due to security
restrictions, I assume).
I tested this on an Asus Transformer Tablet with Android 4.2. Any suggestions?
nsISound is not implemented on Fennec.
HTML5 audio should work with data URis. Read your audio file, base64-encode it and pass it as src e.g. "data:audio/ogg;base64," + base64encodeddata

How to play YouTube videos in a Windows8 html/javascript app?

How can I play YouTube videos in a Windows 8 html/javascript app? I have the clip's id and I just want to play it. Perhaps via html5's video tag?
I've tried the iframe api, but failed to get it to work. I've also made a try on the javascript api, but it failed to load javascript from anther location.
Any help on the subject would be very appreciated!
I developed a YouTube class for Windows Phone which gets the MP4 link of a YouTube movie. Maybe you can use this code and start the video app with the MP4 link or set the source of a media element (if existent in Win8)?
If there's a way to start the video app with a predefined MP4-URL I can rewrite the code for Windows 8.
http://mytoolkit.codeplex.com/wikipage?title=YouTube
UPDATE: I've updated the code. Now simply load the URL with this async method:
var url = await YouTube.GetVideoUriAsync("youtube_id");
myMediaElement.Source = url.Uri;
myMediaElement is a XAML MediaElement control.
Check out the whole library from the project's Subversion repository: http://mytoolkit.codeplex.com
Update: Sorry it's C# only, you have to port it to Javascript...

Enhancing video quality in Blackberry Application

I am facing a problem in enhancing quality of the video feed that i recieve from the camera. For live video feed I am doing something like this
Player player= Manager.createPlayer("capture://video?encoding=jpeg&width=1280&height=1024&quality=normal");
Is there any way to improve video quality in this case and what options are available for 'quality' parameter?
Check the CameraDemo app from the BB SDK (should be present on yout dev PC).
It has a part that extracts/iterates all available for a device encoding properties:
String encodingString = System.getProperty("video.snapshot.encodings");
... the rest of the code
For instance, I noticed it is possible to request superfine quality: .. &quality=superfine

Simultaneously playing and recording video on blackberry smartphone

I intend to record and play video at the same time on my application. I am using BlackBerry JDE 5.0 and the Blackberry 9550 .
I initialize two players, one to play media, and another one to record media. I used Manager.createPlayer(rtsp://server ip: port) to play video.
String myEncoding = "encoding=video/3gpp&width=360&height=480&fps=6&vi​?deo_rate=16000&rate=8000";
mRecordPlayer = javax.microedition.media.Manager.createPlayer("cap​ture://video?" + myEncoding);
mRecordPlayer.realize();
_recordControl = (RecordControl)mRecordPlayer.getControl("RecordCon​trol");
mRecordPlayer.start();
I have recorded to a file . but the file always is 0 kB. I do not believe this way :createPlayer("capture://video?" + myEncoding) can record video from other player. It just records video from camera.
Is it possible to achieve the desired functionality with the API's exposed by RIM.
I would really appreciate if anyone could provide some pointer or help to solve the above mentioned problems.

Resources