29
Multimedia in Silverlight Carl Franklin Franklins.Net [email protected]

Silverlight Multimedia

Embed Size (px)

Citation preview

Page 1: Silverlight Multimedia

Multimediain

Silverlight

Carl Franklin Franklins.Net

[email protected]

Page 2: Silverlight Multimedia

• Media Features in Silverlight 3.0 / 4.0• Encoding• MediaElement Overview• Third-Party Projects• Cool Demos!• Let us repair to the pub

Multimedia Overview

Page 3: Silverlight Multimedia

• Supported Resolutions:– All – up to 720/1080p

• Codecs:– H.264 Native– MP4/F4V– WMV – SMPTE VC-1 Standard– Third-party codecs

• GPU Acceleration• Olympics, Sunday Night Football, DNC, Presidential

Inauguration.

True HD Video

Page 4: Silverlight Multimedia

• Adapts bitrate/quality as bandwidth/cpu changes• HTTP-based• Quick start-up time• Minimal buffering• Uninterrupted viewing• Requires IIS 7.0 Media Services• Live Smooth Streaming (in Silverlight 4)

– PVR-style access– Navigation, scrubbing

IIS Media Services : http://www.iis.net/mediaSmooth Streaming Demo – Watch it in actionhttp://shrinkster.com/1d0g

Smooth Streaming

Page 5: Silverlight Multimedia

• One-to-many video broadcasting• Silverlight 3.0

– QUMU Plugin (http://www.qumu.com)– Free on Codeplex– Polycom Video Media Center 1000 uses it

• Silverlight 4.0– Built-in. No plugin necessary.

Multicast Support

Page 6: Silverlight Multimedia

• Write once. Run on Windows, Mac, and Linux• Store and play offline video out-of-browser• DRM for stream and content protection

– Silverlight DRM– Windows Media DRM– PlayReady

• Advertising Support– Linear pre-rolls– Post-rolls– Interstitials– Non-linear tickers– Bugs– Transparent overlays

General Silverlight Features

Page 7: Silverlight Multimedia

• Expression Encoder– Convert Videos to Silverlight-compatible WMV– Create HTML/Javascript Template– Copy to web server– Rock and roll

Encoding Videos for Silverlight

Page 8: Silverlight Multimedia

• Expression Encoder Live Encoding Feature– Select Video Source– Select Push or Pull Modes– Publish– Rock and Roll– Small potatoes – doesn’t scale.

Live Encoding

Page 9: Silverlight Multimedia

• Real geeks use hardware– InLet Technologies Spinnaker– http://shrinkster.com/1d0r– Olympics :

• 20 of these @ 20K each• IIS Server Farm

– Camera -> Inlet -> IIS7 -> CDN• CDN = Content Delivery Network

– Akamai, Limewire» Big $$

Hardware Encoding

Page 10: Silverlight Multimedia

MediaElement

Plays video or audio• Streamed or downloaded media• Video: WMV, H.264• Audio: AAC, MP3 and WMA• Add Media File to your project

– Set Build Action property (of media file) to Resource<MediaElement Source="bear.wmv" />

Page 11: Silverlight Multimedia

• Scrubbing Media– Works on Downloaded or Buffering Media– Position method is writable

• Position not valid until MediaOpened Fires• Downloaded media it simply changes the

location• Buffering media it may cause re-buffering• NaturalDuration gives you the length of the

media– Though may be invalid in some streams

(e.g. Live)

Using MediaElement

thePlayer.Position = thePlayer.Position.Add(TimeSpan.FromSeconds(5));

Page 12: Silverlight Multimedia

• Markers– Media must contain markers to work– MarkerReached Event Fired when a marker is

reached• Sends a TimeMarker object as the event

argument

Using MediaElement

void thePlayer_MarkerReached(object sender, TimelineMarkerRoutedEventArgs e) { TimelineMarker m = e.Marker; theStatus.Text = string.Format("{0}:{1}:{2}", m.Type, m.Text, m.Time);}

Page 13: Silverlight Multimedia

• Silver Bay Labs Development Guide Videos– Table of Contents on Left– Video on Right– Important Code in Textbox below video– http://shrinkster.com/1d0j

Good Use of Markers

Page 14: Silverlight Multimedia

• Play Position– No event for Position Change– Use Binding to Position Property Instead

Using MediaElement

<TextBlock Text=“{Binding ElementName=MediaElement1,

Path=Position}” />

Page 15: Silverlight Multimedia

• Video Capture• Media Security

What’s New in Silverlight 4.0?

Page 16: Silverlight Multimedia

• Webcam and Microphone Support– AsyncCaptureImage

• Captures a single frame, sends bitmap to callback

– VideoBrush.SetSource• Sets the source of the VideoBrush using a video

capture source

Webcam Sample Apps online:http://shrinkster.com/1d0o

Video Capture

void AsyncCaptureImage(Action<WriteableBitmap> Callback)

void SetSource(CaptureSource source)

Page 17: Silverlight Multimedia

• VideoSink– Base Class for creating video capture classes– Override OnSample, convert data to your format– CaptureSource property provides a capturesource

associated with your VideoSink• CaptureSource

– Use AsyncCaptureImage to capture a frame• VideoCaptureDevice

– Provides metadata for a video capture device, such as a webcam.

Webcam Sample Apps online:http://shrinkster.com/1d0o

Video Capture Classes

Page 18: Silverlight Multimedia

if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess()){ VideoCaptureDevice vcd = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice(); AudioCaptureDevice acd = CaptureDeviceConfiguration.GetDefaultAudioCaptureDevice(); if (null != vcd && null != acd) { cs = new CaptureSource(); cs.VideoCaptureDevice = vcd; cs.AudioCaptureDevice = acd; cs.Start();  VideoBrush videoBrush = new VideoBrush(); videoBrush.Stretch = Stretch.Uniform; videoBrush.SetSource(cs); TO_FILL.Fill = videoBrush; } else MessageBox.Show("Error initializing Webcam or Microphone.");}

Video Capture Sample

Page 19: Silverlight Multimedia

• Protection for Content Owners– Protected content is only viewed through a secure

connection• Supported Scenarios:

– Rental, Subscription, Purchase• Read Output Protection policies inside PlayReady

Licenses• Offline Content Protection for H.264 media through

Silverlight DRM– Two methods

• Windows Media DRM (WMDRM10)• PlayReady (AES)

Content Security

Page 20: Silverlight Multimedia

• Silverlight Media Player• Silverlight Media Framework• Silverlight Hyper-Video• Augmented Reality

Third Party Goodies and the Future

Page 21: Silverlight Multimedia

• Lightweight, enough features for most video streams• Used by Channel 9 • Developed by Tim Heuer of Microsoft and MVP Joel

Nuebeck• http://shrinkster.com/1d0p

Silverlight Media Player

Page 22: Silverlight Multimedia

• Came out of Vertigo Software’s work with Olympics and Sunday Night Football

• Does all the heavy lifting• Rich multimedia control

– DVR, Rewind, Alternate Language Tracks, In-stream Data Feeds, Analytics Tracking, Player Branding, Markers.

• http://smf.codeplex.com/

Silverlight Media Framework

Page 23: Silverlight Multimedia

• 11-18-09– SMF Released at PDC

• 1-15-10– SMF v1.1 released

• Progressive Download Added• SMF v2.0 under development

SMF Timeline

Page 24: Silverlight Multimedia

• Timeline Markers• Progressive Download Support• Smooth Streaming Support• IIS In-Stream Data Access Framework• Out-of-Stream Data Access Framework

SMF Player 1.1 Features

Page 25: Silverlight Multimedia

• Playlists• Chapters• Manifest Marker Support• Javascript API• Closed Captioning• W3C Timed Text 1.0 DFXP Support• UI Automation• Media Plug-In Model• Logging Plug-IO

SMF 2.0 Additional Features

Page 26: Silverlight Multimedia

• Hypertext-like features for Video– Jesse Liberty – http://shrinkster.com/1d0q– Click or gesture while watching a video– Video pauses and you get some other information

• Usually another video• Could be any kind of media

– Uses the MEF framework• http://slhvp.com• Video Demo: http://shrinkster.com/1d0s

Silverlight Hyper Video Project

Page 27: Silverlight Multimedia

• Augmented Reality– Adding to (or augmenting) video with

superimposed or embedded graphics.• SLAR Toolkit

– http://slartoolkit.codeplex.com/– Silverlight 4.0 Only– Webcam support via CaptureSource– Multiple Marker Detection, Custom markers– Uses the Matrix3DEx library by Rene Schulte

• Adds 3D features to Silverlight• http://matrix3dex.codeplex.com/

SLARToolkit – Silverlight AugmentedReality Toolkit

Page 28: Silverlight Multimedia

• Sharepoint Video Player– Embed video streams into your Sharepoint

website.– http://svp.codeplex.com/

• xLite Player– http://xliteplayer.codeplex.com/

Other Players

Page 29: Silverlight Multimedia

• Scott Guthrie’s Silverlight 4 Demos from PDC– http://shrinkster.com/1d0f

• Silverlight 4 Demos– http://shrinkster.com/1d0o

• Sunday Night Football– http://www.vertigo.com/snf

• March Madness– http://mmod.ncaa.com/video?player=hq

Demos!