Presentation is loading. Please wait.

Presentation is loading. Please wait.

What’s new for Windows 8 Devs Part 3 Lewis Benge Devices & Integration Team TBWA\Digital Arts Network DEV216.

Similar presentations


Presentation on theme: "What’s new for Windows 8 Devs Part 3 Lewis Benge Devices & Integration Team TBWA\Digital Arts Network DEV216."— Presentation transcript:

1 What’s new for Windows 8 Devs Part 3 Lewis Benge Devices & Integration Team TBWA\Digital Arts Network DEV216

2

3

4 Camera

5

6 Snap a picture, record video and audio. Capture Windows.Media. Input and output audio devices such as Bluetooth. Devices Work with audio playlists. Playlists Stream media to a television or audio system. PlayTo Use PlayReady or other content protection systems. Protection Convert music or video to other formats or resolutions, trim, or make effects permanent. Transcoding Insert or remove well-known video effects. VideoEffects CameraCaptureUI MediaCapture Camera Capture UI  Similar to ‘pick’ photos or videos from the file system  Built-in camera control with pre-defined user workflow Media Capture API  You control every pixel on screen  Custom User Experience and workflow

7 You control every pixel on screen Custom User Experience and workflow Enumerate cameras Support various formats: MP4, WMV, M4A, MP3, WMA (Additional formats possible through extensions) Allow various encoding settings Media Capture Built-in camera control with pre-defined user workflow Similar to ‘pick’ photos or videos from the file system Specify quality of capture Set Timers Adjust settings, including IHV settings CameraCaptureUI

8 demo

9 Accessing Camera and Mic from your app // Application manifest capabilities required to access camera and microphone

10 Using the camera to snap a photo (JS) // Step 1: Invoke the camera capture UI for snapping a photo var captureUI = new Windows.Media.Capture.CameraCaptureUI(); captureUI.captureFileAsync(Windows.Media.CameraCaptureUI.Mode.photo). then(function(capturedItem) { if (capturedItem) { // Step 2: Display the photo document.getElementById(“imagedisplay”).src = URL.createObjectURL(capturedItem); } else { document.getElementById(“message”).innerHTML = “User didn’t capture a photo”; } });

11 Using the camera to record a video (JS) // Step 1: Invoke the camera capture UI for record a video var captureUI = new Windows.Media.Capture.CameraCaptureUI(); captureUI.captureFileAsync(Windows.Media.CameraCaptureUI.Mode.video). then(function(capturedItem) { if (capturedItem) { // Step 2: Display the video document.getElementById(“videoplayback”).src = URL.createObjectURL(capturedItem); } });

12 demo

13 Starting preview on a function initializeMediaCapture() { // Step 1: create Media Capture object var mediaCaptureMgr = new Windows.Media.Capture.MediaCapture(); mediaCaptureMgr.initializeAsync().then( function (op) { // Step 2: Update the source of document.getElementById(“preview").src = URL.createObjectURL(mediaCaptureMgr, false); // Step 3: Start displaying the camera feed document.getElementById(“preview").play(); }); }

14 Recording a video Windows.Storage.KnownFolders.videosLibrary.createFileAsync("cameraCapture.mp4", Windows.Storage.CreationCollisionOption.generateUniqueName).then(function (newFile) { storageFile = newFile; encodingProfile= Windows.Media.MediaProperties.MediaEncodingProfile.createMp4( Windows.Media.MediaProperties.VideoEncodingQuality.auto); mediaCaptureMgr.startRecordToStorageFileAsync(encodingProfile, storageFile).then( function (result) { // recording, eventually stop it. // mediaCaptureMgr.stopRecordAsync(); }, errorHandler); }, errorHandler);

15 Capture Audio Windows.Storage.KnownFolders.videosLibrary.createFileAsync("cameraCapture.m4a", Windows.Storage.CreationCollisionOption.generateUniqueName).then(function (newFile) { storageFile = newFile; encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createM4a( Windows.Media.MediaProperties.AudioEncodingQuality.auto); mediaCaptureMgr.startRecordToStorageFileAsync(encodingProfile, storageFile).then( function (result) { //recording, eventually stop it.. mediaCaptureMgr.stopRecordAsync(); }, errorHandler); }, errorHandler);

16 Ambient Light Sensor Motion Sensor Fusion (Accelerometer, Magnetometer, Gyroscope) Windows Location Provider GPS (If mobile broadband hardware is present) Tablet and convertible standard equipment:

17 Location

18

19 Declare the need for Geolocation // Application manifest capabilities required // to access Geolocation in your app

20 GeoLocation using Windows API var loc; loc = new Windows.Devices.Geolocation.Geolocator(); //One-time loc.getGeopositionAsync().then(getPositionHandler); loc.addEventListener("positionchanged", function () { getPositionHandler ( args.position);}); function getPositionHandler(pos) { var lat = pos.coordinate.latitude; var long = pos.coordinate.longitude; var acc = pos.coordinate.accuracy; }

21 demo

22 Sensors

23

24 ShakeRotateFlip

25 DarkIndoorsOutdoors

26 Simple Data Simple Device Orientation Sensor Fusion Data Compass Inclinometer Device Orientation Light Sensor Accelerometer Raw Sensor Data Gyro

27 Accelerometer Sample Code var accelerometer; accelerometer = Windows.Devices.Sensors.Accelerometer.getDefault(); accelerometer.addEventListener("readingchanged",onAccReadingChanged); function onAccReadingChanged(e) { var accelX = e.reading.accelerationX; var accelY = e.reading.accelerationY; var accelZ = e.reading.accelerationZ; }

28

29 3D Accelerometer 3D Gyro 3D Magnetometer Pass-Through Accelerometer Gyro Sensor Fusion Compass Inclinometer Device Orientation

30 ST Microelectronics eMotion Development Board

31

32 NFC

33 Windows.Networking. BackgroundTransfer Retrieves connection profiles (mobile broadband) Connectivity Mobile broadband account managementNetworkOperations Proximity devices in close range Proximity Encapsulates push notificationPushNotifcations Native web and TCP/UDP socket support Sockets Enables advance download and upload transfer

34 Determine when an NFC device enters (JS) function initializeProximityDevice() { var proximityDevice = Windows.Networking.Proximity.ProximityDevice.getDefault(); proximityDevice.addEventListener("devicearrived", proximityDeviceArrived); proximityDevice.addEventListener("devicedeparted", proximityDeviceDeparted); } function proximityDeviceArrived() { id("messageDiv").innerHTML += "Proximate device arrived. id = " + device.deviceId + " "; } function proximityDeviceDeparted() { id("messageDiv").innerHTML += "Proximate device departed. id = " + device.deviceId + " "; }

35 demo

36 Touch

37

38 Press and hold to learn Tap for primary actionSlide to dragSwipe to select Pinch to zoom Swipe from edge for app and system UI Rotate to rotate

39 “Code for touch, get mouse and pen for free!”

40

41

42 API surfaceCSS PropertiesDOM AttributesDOM Events Scrolling overflow -ms-scroll-rails -ms-scroll-snap-x -ms-scroll-snap-y -ms-scroll-chaining -ms-scroll-boundary scrollLeft scrollTop scroll Zooming -ms-content-zooming -ms-content-zoom- boundary -ms-content-zoom-snap msContentZoomFactorMSContentZoom BothMSManipulationStateChanged Snap-points -ms-scroll-snap-type -ms-scroll-snap-point-x

43

44

45 Other devices

46 Enumeration Windows.Devices. Geolocation Provides support for identifying the input devices. Input Identifies Windows Portable Device (WPF) services Portable Print task configuration and print notifications Printers Access to supported sensors and motion data Sensors Ability to send, receive, and delete SMS messages. Sms Enables app developers to easily access the computer’s geographic location. Device discover and notifications about devices.

47

48 Hardware recap

49

50


Download ppt "What’s new for Windows 8 Devs Part 3 Lewis Benge Devices & Integration Team TBWA\Digital Arts Network DEV216."

Similar presentations


Ads by Google