Download ppt - Video Streaming in Flash

Transcript
Page 1: Video Streaming in Flash

Video Streaming in FlashVideo Streaming in Flash

CSCI 4220 – Network ProgrammingCSCI 4220 – Network Programming

Kacper HarabaszKacper Harabasz

Page 2: Video Streaming in Flash

ChallengesChallenges

• Video’s major problem is compression, which leads to many proprietary formats.

• Today’s major players are Microsoft, Real, Apple’s QuickTime, and now Flash.

Page 3: Video Streaming in Flash

Why Choose Flash?Why Choose Flash?

• Other players can require video drivers on top of their players. For example DivX.

• Flash circumvents this by converting stream able media to its own format, which is better compressed and optimized for streaming, although at a loss to quality.

• It is really easy. Adobe has done most of the work for you.

Page 4: Video Streaming in Flash

Streaming in FlashStreaming in Flash

• Flash is Vector, not Bitmap based.• Images are represented as a set of points

and geometric figures, as opposed to pixels.

• Adobe is the ‘leader’ in both markets, with Photoshop (bitmap), Illustrator (vector), Director Suite (vector).

• Free alternates are The Gimp (bitmap) and Inkscape (vector).

Page 5: Video Streaming in Flash

Streaming in FlashStreaming in Flash

• Thanks to this vector representation, Flash can save considerable space over other formats.

• This is done by storing the representation of an image in the first frame of animation, and than having each successive frame hold information on how the vector changes.

• The actual codec belongs to Sorenson Media, and the product is called Sorenson Squeeze.

• Most other formats stream on a per pixel basis. Each pixel that changes from frame to frame must be sent in the stream.

Page 6: Video Streaming in Flash

Progressive DownloadProgressive Download

• Flash Player caches the media as it is downloaded from the destination. This is a very convincing imitation of streaming. Some Limitations are:– It cannot be used for live events, only stored video

files. – It is less efficient than true streaming. – It cannot automatically adjust for the end user's

connection speed. – It is not secure, the video file is saved on the end

user's computer. – The end user cannot jump ahead to a later part of the

video until it has downloaded.

Page 7: Video Streaming in Flash

Flash Media ServerFlash Media Server

• In Adobe’s own words, “The product is server based software which runs media applications developed for it with the Flash authoring tool.”

• Works by opening a "persistent connection" between the server and client. In a normal server/client relationship the client sends periodic requests to the server as required. With a persistent connection the server and client are in constant, controlled contact.

• Handles Bandwidth detection, Player detection (flash version), Dynamic buffering, basically everything that usually gives network programmers a headache.

Page 8: Video Streaming in Flash

Case Study - YouTubeCase Study - YouTube

• Developed by Steve Chen, Chad Hurley, and Jawed Karim, while working at PayPal.

• Needed a way to post a video online after a party. At that time, there was no easy way to do it.

Page 9: Video Streaming in Flash

How is it done?How is it done?

• When a user uploads a video to YouTube, an ‘agent’ processes the upload to produce a .flv (Flash Video File) using Adobe’s Video Encoder. Also, a still image is captured to represent the clip during search results and previews.

• A short 10-12 char, randomly generated string serves as the ‘key’ for the media.

Page 10: Video Streaming in Flash

How is it done?How is it done?

• Flash Player and Flash Media Server• Player embedded into webpage.• The embed calls a url, which is re-written

to hit a script that converts the ‘key’ to the location of the media on the Flash Media Server. A new url is constructed, and the script forwards the original embed call to a Flash Player with the location of the media on the Flash Media Server.

Page 11: Video Streaming in Flash

How is it done?How is it done?

• Now that it is correctly referencing the media, the Flash Player and Flash Media Server interact to stream the media. This is true streaming.

• Flash provides the classes that handle this interaction for the programmer.

Page 12: Video Streaming in Flash

Creating a PlayerCreating a Player

• Demonstration of a Progressive Download Streamer (Hey, Flash Media Server isn’t cheap!)

• Short Introduction to the Flash Environment.

• Explanation of Code.


Recommended