Up and Running with Flash Media Server 4.5

Up and Running with Flash Media Server 4.5

with Lisa Larson-Kelley

 


Join author Lisa Larson-Kelley as she shows how to deliver media across multiple platforms and devices with video streaming protocols such as Real-Time Messaging Protocol (RTMP), HTTP Dynamic Streaming (HDS), and HTTP Live Streaming (HLS). The course defines basic streaming terminology and shows how to capture and stream video, add DVR functionality, and write server-side code. The course also includes a simple project that demonstrates how to create a two-way video conferencing application.
Topics include:
  • Why use Flash Media Server?
  • Choosing a delivery protocol
  • Understanding codecs
  • Installing and testing Flash Media Server
  • Streaming on-demand and live video with RTMP and HDS
  • Writing and testing custom server-side applications
  • Publishing multi-bitrate streams
  • Streaming live video to devices with HLS
  • Delivering video across platforms with JavaScript

show more

author
Lisa Larson-Kelley
subject
Developer, Video, Web, Servers, Web Video
software
Flash Media Server 4.5
level
Beginner
duration
2h 31m
released
Oct 25, 2011

Share this course

Ready to join? subscribe


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:04Hi, I am Lisa Larson-Kelley, a developer, instructor and consultant specializing
00:08in web video delivery.
00:10I am the founder of LearnFromLisa.com and an Adobe Community Professional.
00:15Welcome to Flash Media Server 4.5!
00:18In this course I'll get you started with streaming to Adobe Flash.
00:21I'll walk you through installing the server and I'll introduce you to some
00:25common terminology as well.
00:27Finally, I'll show you how to stream video to Apple iOS devices and stream that
00:31same video to Android power devices, and we will do all of this through both
00:36conceptual explanations and practical exercises, giving you everything you need
00:40to get started using the exciting features of Flash Media Server 4.5.
00:44We've got a lot of ground to cover, so let's go.
Collapse this transcript
What you need to know
00:00There are few details you should be aware of before we get started.
00:03We will be running FMS on Windows 7 in 64-bit mode in this course.
00:08While this is supported by Adobe for the development edition of FMS, there are
00:11security issues that you should be aware of and we will need to work around.
00:15You need to be running as administrator, which isn't normally recommended
00:18by Microsoft, therefore, I recommend that you only run as admin when you're
00:22developing for FMS and switch back to your standard permissions when you're finished.
00:26If you're concerned about security issues, you can use a hosted service that
00:30specializes in FMS, such as Influxis.com or Amazon Web Services and follow along
00:36with the examples using your hosted server.
00:38I also recommend using the latest version of Flash Player 10.3 or later at
00:42least, for the best compatibility with the exercises.
00:45And one important note, for most of this course we will be testing our apps
00:49on the same computer that's running FMS, so you won't need to do any special configurations.
00:53But when we get into the exercises where we are testing streams on devices, we
00:58will need to stream across the network, rather than just on the computer running FMS.
01:02There are three ways you can set this up.
01:04You can run FMS on a Web Server accessible over the Internet.
01:08You can use a hosted FMS server, set up on Amazon Web Services are Influxis,
01:13or run FMS on a computer on your local network, this is how we'll do it in this course.
01:18And if you choose to do this, there are a couple of things you'll need to do to set this up.
01:22First you'll need to open up port 1935 on your router, and you'll need to know
01:26the IP address of the computer running FMS.
01:29This IP address will be part of the URL that we will use to connect to FMS and
01:33stream content as you'll see.
01:35If you are just testing everything locally, localhost will work for your address.
01:39This will allow other computers and devices on your network to connect to FMS.
01:43If you have trouble with configuring your router, I suggest you refer to your
01:46router's documentation, as each manufacturer handles settings differently.
01:50My goal for this course is to provide you with the basics of video delivery and
01:54a quick way to get up and running with Flash Media Server.
01:56Unlike my other titles, we won't be building a full-featured video player or
02:00embedding video into a web page.
02:02What you will get is a quick-start guide to one of the most challenging tasks a
02:06Web professional can tackle streaming video online.
02:09Let's get started by examining what you can do with Flash Media Server and why
02:12you'd want to use it.
Collapse this transcript
Using the exercise files
00:01If you're a Premium Member of the lynda. com Online Training Library or if you're
00:05watching this tutorial on a DVD-ROM, you have access to the Exercise Files used
00:10throughout this title.
00:11I've got mine here on the Desktop but you can save yours wherever you like.
00:14While this course does not have long involved exercises, there are some assets
00:19available for you to work with, so you can follow along with the streaming
00:22examples, along with the Webcam Broadcast Code.
00:24These Exercise Files are organized by Chapter and then by Movie.
00:29We will be playing sample video files using various delivery methods,
00:33creating multi-bit rate playlists and building a Live Broadcast Application
00:37in Flash Professional.
00:39In all cases the final files will be provided to you with the exercise files,
00:43so you can check your work, or you can just use them right away if you want to
00:46skip the creation steps.
00:47If you are a monthly member or an annual member of lynda.com, you don't have
00:51access to the exercise files, but you can follow along from scratch with your own assets.
00:55Okay, let's get started!
Collapse this transcript
1. Getting to Know Flash Media Server
What is Flash Media Server and why use it?
00:00Flash Media Server is no longer just a simple streaming server.
00:04It now packages video files in various formats on the fly, integrates
00:08peer to peer and real time communication and enables media delivery to desktops
00:13or devices, even iOS, all of this and more is possible with this powerful server software.
00:19There are a lot of inherent benefits to streaming video with FMS, rather than
00:22simply serving it using Progressive Delivery.
00:25You use less bandwidth, unlike progressive delivery, streaming only transfers
00:29the bits that are being watched.
00:31Progressive requires you to buffer or preload the video data to achieve smooth playback.
00:35So you are sending a lot of information that may never actually be watched.
00:39Streaming is more secure, none of the video data is cached on the client
00:42computer when it's streamed over RTMP, it is cached when using
00:46Progressive Delivery.
00:47This means the viewer has your video on their hard drive, viewers can seek
00:51freely unlike Progressive Delivery when the video can only jump to a keyframe.
00:55FMS creates keyframes on-the-fly, so viewers can accurately seek to any point in a video.
01:01Dynamic Streaming allows you to detect the viewers' available bandwidth
01:04and their processing power, and deliver them the most optimized version of the stream.
01:08I will show you how this is done in upcoming lessons.
01:11You can set up custom logging and analytics with FMS, to track data such as
01:15viewer interaction and quality of service metrics, that's very difficult to do
01:19with simple progressive delivery.
01:21There are various stream protection options available with FMS, from encrypted
01:25RTMP to SWF verification, to Flash Access File Encryption and even New
01:30Protective Streaming.
01:31Now we won't get into too much detail about these features, but just know that
01:36they are available to you in FMS, if you really need to lock down your streams.
01:40And finally, the big benefit to upgrading to FMS 4.5 is new support for iOS streaming.
01:46So now, for example, you can ingest one live stream into FMS and deliver that
01:51stream to Flash Player in the Browser, AIR on the Desktop, Flash Player on
01:54Android, and HLS streams to iOS devices, such as the iPad and iPhone.
02:01Now for the specifics, FMS runs on Windows and Linux, and is now 64-bit only.
02:07Versions prior to 4.5 will also run on 32-bit systems.
02:12There are four editions, Flash Media Streaming Server, which is an optimized
02:16build that lets you sufficiently stream media files and live broadcasts, to both
02:21Flash and iOS, and this has a lower price point of $995.
02:27Flash Media Interactive Server is the full-featured build of FMS.
02:31It not only gives you the features of the streaming server, but also supports
02:35enhanced content protection, multi-way communication applications, server side
02:39recording and other enhanced features such as DVR.
02:43Now in 4.5, you also get Multicast and Peer-to-Peer features and this
02:48allows applications such as video chat, voice over IP, text chat, and multiplayer games.
02:54Flash Media Enterprise Server is the premium edition.
02:57As its name implies, it's targeted to larger companies, as you can see by the
03:01price, and this has all the bells and whistles, including Multicast and
03:05Peer-to-Peer with higher limits.
03:07Then there is the Flash Media Development Server and this one has all the
03:10functionality of the Enterprise Server, but, limits you to 10 simultaneous RTMP
03:16connections and 10 Peer-to-Peer connections.
03:19It's notable however that the user agreement does allow you to use the
03:22development server for production, and this will let you use it for
03:26applications, such as kiosks, things like that, or you would not generally need
03:30a lot of connections, or you could use it as an origin server, or you could
03:34broadcast a single stream out to a CDN or a Content Delivery Network for
03:40delivery to a larger audience, and this is the server we will be installing in
03:43this course and it's a free download from adobe.com.
03:46Now in this course we will be installing and testing streams locally, but when
03:50you're ready to start streaming publicly over the Internet, you'll need to run
03:54FMS on a publicly accessible web server, rather than set this up yourself,
03:59another option is to choose a hosting service that supports FMS.
04:02Now Adobe has partnered with Amazon to release Flash Media Server for Amazon
04:07EC2, and this is a hosted version of the Enterprise Server that lets you pay as
04:13you go for the full enterprise features.
04:15Does require a number of complex configuration steps to get it set up, so while
04:20it's a good solution for full-featured scalable streaming, it does require a
04:24bit of a commitment.
04:25And as of right now, FMS 4 .5 is not yet available.
04:30There are also other hosted options if you just want to get up and
04:33streaming quickly, and one that I highly recommend for their service and
04:37pricing is Influxis.com.
04:39They offer Flash Media Interactive Server and Flash Media Enterprise Server
04:44hosting for an affordable monthly fee, and there's no complicated configuration.
04:48You just signup for an account, and you can start streaming right away.
04:51Now the main selling points of FMS include, multiple video delivery methods,
04:57live and on-demand streaming via RTMP, HTTP dynamic streaming, which is
05:03referred to as HDS.
05:05HTTP live streaming, which is also referred to as HLS, and if that's all just
05:10acronym salad to you right now, don't worry, we'll cover all the details.
05:14Just in time packaging of streams, this means you don't need to convert your
05:18video files into the right format for each delivery method, FMS will do this for you.
05:23Integrated real time interactivity, you can not only stream video and audio,
05:27but also data with FMS.
05:29This lets you create multiplayer games, shared whiteboards, text chat and more,
05:33right alongside your video.
05:35Content protection, as I mentioned earlier, there are many ways to protect your
05:39content with FMS, and tracking and logging, FMS gives you finite control over
05:44audience measurement.
05:46And that gives you a good overview of the benefits of FMS and what editions are available.
05:51Now let's look a bit closer at the new features in FMS 4.5.
Collapse this transcript
What's new in Flash Media Server 4.5?
00:01Next, let's look specifically at the new features introduced in Flash Media
00:05Server 4.5, HLS Streaming and Real Time Video File Packaging among others.
00:10The biggest new feature is the ability to stream video to Apple devices
00:14using HLS Streaming.
00:16This is supported with both on-demand and live streams.
00:20Now this isn't flash on the iPhone.
00:23What FMS actually does is converts a video file or an RTMP stream into a format
00:29that can be played on iOS.
00:31That format is MPEG TS and it's delivered via HTTP Live Streaming or HLS.
00:39It also automatically extracts the audio file which is required for App Store approval.
00:44This is similar to Adobe's HTTP Dynamic Streaming or HDS, but the file format
00:50isn't exactly the same, so they are not interchangeable.
00:54Both are delivered over HTTP and both break the video into small fragments that
00:59are delivered to the media player and reassembled in the correct order.
01:03And both support adaptive streaming where you can detect the user's bandwidth
01:07and deliver an appropriate bit rate stream.
01:09But HLS will only play nice with Apple and that's in its native iOS player, in
01:14Safari, or in the QuickTime player.
01:16And HDS only works in Flash.
01:19I'll cover this more in depth in an upcoming chapter.
01:22The next big new feature is also related to HTTP delivery, real-time packaging
01:28of existing files for HDS and HLS delivery.
01:32In the previous version of FMS, when you wanted to deliver a video using HDS,
01:37you had to prepare each video file in advance, by running it through the
01:40f4fpackager after encoding.
01:43And this was an extra step in your workflow.
01:45Now in FMS 4.5, this extra step is handled for you automatically.
01:51When someone requests a video over HDS, the f4fpackager will package that
01:56existing MP4 file into the correct format on the fly.
02:00The same process will happen for HLS delivery to iOS devices as well.
02:05Packaging of the stream to an MPEG TS format is handled for you on the fly, for
02:10both live and on-demand streams.
02:13This is a feature that really makes FMS shine, allowing you to reach lots of
02:17different devices without extra steps in your workflow.
02:20The next exciting new feature is Protected HTTP Streaming.
02:24This is a scaled down version of Adobe Flash Access that's been integrated in with FMS.
02:30You can use it to encrypt your video files and play certain business rules, such
02:34as setting a 24-hour window for video playback.
02:38This is good for special events and other premium content.
02:41Another long-awaited feature is support for SIP-enabled devices.
02:46This will allow you to connect people using Adobe Flash or AIR apps to
02:51conference rooms, mobile phones, or other SIP enabled communication services.
02:56Now this was previously part of Flash Media Gateway and has now been
03:00integrated right in with FMS.
03:03Now I won't be covering the specifics of SIP or Protected HTTP Streaming in this
03:08course, but advanced users will find details in the FMS documentation.
03:13The next feature is important for enterprise customers.
03:16You can now ingest a source stream via multicast.
03:19This is an important improvement in live broadcast efficiency on closed networks.
03:24And finally, FMS is now optimized to run on 64-bit operating systems.
03:29This lets FMS take advantage of the speed of 64-bit architecture and improves
03:33the overall performance of the server.
03:35There is still a 32-bit development server available, but it's not
03:38recommended for production.
03:40Now that we've talked about what's new in FMS 4.5, let's move on to a higher
03:44level look at how video is delivered on the Flash platform, and get you up to
03:48speed on all of these different delivery methods that we have available in FMS.
Collapse this transcript
2. Understanding the Delivery Protocols
Understanding the Real-Time Messaging Protocol (RTMP)
00:00Before we dive into installing the server and streaming, I think it's important
00:04to take a step back and understand the ways that video can be delivered using
00:08Flash Media Server, as all of the acronyms can get pretty confusing.
00:12In this chapter, I'll give you an overview of each delivery method and how it
00:16works on Flash Media Server.
00:18The best place to start is with the original Flash Streaming Protocol, RTMP.
00:23RTMP stands for Real Time Messaging Protocol.
00:27It's a TCP based protocol that Adobe developed for streaming audio, video, and
00:33data, between Flash Media Server and Flash Player.
00:36A two way connection is opened between the two and this allows them to
00:40communicate in real-time back and forth.
00:42The data they exchange can be prerecorded or live video and audio, or it
00:47could even be data such as text chat or X and Y coordinates of players in a multiplayer game.
00:52RTMP is a great solution to stream media and share data between clients who have Flash Player.
00:58Here's a bird's eye view of how RTMP works.
01:01First, the Flash Player SWF contacts the FMS server and an RTMP connection is
01:06opened between them.
01:07Then the Flash Player requests a specific video stream.
01:11This could be a prerecorded stream, which is stored on the FMS server itself or
01:15a live stream that's being broadcast either from another connected Flash SWF or
01:20from a Flash Media Live Encoder.
01:23Once FMS receives the request for the stream, it's sent directly to the Flash
01:27SWF over the RTMP connection.
01:30The same stream can be sent out to any number of clients who request it,
01:33provided the FMS server and its network have the bandwidth to deliver all of the
01:37simultaneous streams.
01:39Additional FMS servers can be chained together to increase capacity and allow
01:43for very large events.
01:45Later in this course, we'll get our hands on the VOD and live services on FMS
01:50that let us quickly start streaming both live and on-demand video over RTMP to Flash Player.
01:56Next, let's look at HTTP Dynamic Streaming or HDS.
Collapse this transcript
Understanding HTTP Dynamic Streaming (HDS)
00:00HTTP Dynamic Streaming or HDS is a relatively new delivery method added to Flash
00:07Media Server and Flash Player.
00:08It's Adobe's answer to Apple's Adaptive Streaming and Microsoft's Smooth Streaming.
00:14It allows you to deliver video and audio over standard HTTP connections, rather
00:19than Adobe's proprietary RTMP, and it lets you adapt the stream to the
00:24appropriate bit rate for the client's connection speed.
00:27To deliver video over HDS, it must be formatted in a certain way.
00:31The video file needs to be segmented into smaller pieces called fragments.
00:36These files will have the extension f4f;
00:39a manifest file is also needed.
00:41This is a file that contains basic information about the video, the location of
00:45each of the fragments, and what order they should be streamed in.
00:48Both the f4fs and the f4m manifest file are created in a process called packaging.
00:54A common question I hear about HDS is if it's streaming over a standard HTTP
00:59connection, why do I need a media server at all?
01:01Well, that's a good question.
01:02Technically, you don't.
01:04But FMS has some valuable features that make streaming video over HTTP more efficient.
01:09And that now includes real- time packaging of content.
01:12You don't need to package your Flash video files for HDS delivery in advance.
01:16The same files and streams that you use for RTMP can be packaged in real time
01:21for delivery over HTTP.
01:23Let's take a look at this workflow by looking at how a live stream is captured,
01:27packaged, and played back with HDS.
01:29In this scenario, first a live stream is captured in Flash Media Live Encoder
01:34and then sent to the Live Packager Service on FMS.
01:38And this is a pre-built application that now ships with all editions of FMS.
01:42There the live stream is packaged automatically in real time, creating the
01:47fragments and the manifest file.
01:48Then when someone wants to watch this video stream, their video player SWF
01:52requests the f4m manifest file.
01:55FMS sends it to them.
01:56Then based on the information in the manifest, the SWF then starts asking for
02:01f4f in video fragments and then starts playing them.
02:05On-demand streams are packaged and accessed in the same way with fragments and
02:08the manifest being created and cached when requested.
02:11Later in the course we'll set up both an on-demand stream and a live stream to
02:15deliver video over HDS to Flash Player, so you can see this process in action. Okay.
02:20So that gives you an overview of the basic workflow for streaming over HDS to Flash Player.
02:25Next, let's look at how FMS can now deliver that same stream to Apple iOS using
02:31HTTP Live Streaming.
Collapse this transcript
Understanding HTTP Live Streaming (HLS)
00:00The most exciting new feature in Flash Media Server 4.5 is clearly the ability
00:05to stream your videos to iOS devices.
00:08While you lose any of the custom real- time interactivity you might have added to
00:12your Flash-based application, you can get your video to play everywhere without
00:15doing any extra encoding or setting up additional specialized servers.
00:19As of the date of this recording and I'm confident that this will be true far
00:23into the future, Apple's iOS devices do not support Flash.
00:27To make sure that people on iPads, iPhones, and iPods can view your live or
00:31on-demand streams, you need to deliver them in a native format.
00:35And that format is called HTTP Live Streaming or HLS.
00:39Now this can be confusing because the word live is in the name, but it also
00:43supports on-demand streams.
00:45So you can just kind of think of live as real-time conversion, so the video file
00:49or stream is being converted live in real-time to the HLS format by FMS when
00:55it's requested by the client.
00:57This packaging happens using the same workflow we saw in HDS in the previous
01:01lesson, only the file formats are different for HLS.
01:05Let's look at a diagram so you can see this process at a glance.
01:08In this scenario, again, we're capturing a live stream in Flash Media Live
01:12Encoder and this can be the same instance of FMLE and the same stream that we're
01:16using for our Flash stream.
01:18And as this stream is sent to the Live Packager Service, FMS packages it for
01:23both HDS and HLS as needed.
01:26For HLS, an MPEG TS stream is packaged, consisting of TS files and an m3u8 manifest.
01:35Apple calls this file a playlist and Adobe calls it a manifest.
01:39Then when someone on an iOS device wants to watch this video stream, their video
01:43player application will request the m3u8 playlist.
01:47FMS sends them the m3u8 file.
01:50Then based on the information in the playlist, the video player then starts
01:54asking for TS video fragments and starts playing them.
01:58HLS streams can be played in the native video player on iOS or can be embedded
02:03in a Web page using the HTML5 video tag.
02:06For more information, the fantastic course called HTML5 Video and Audio in Depth
02:11that explains the ins and outs of delivering video natively in the browser.
02:15And later in the course, we'll get some hands-on experience with HLS streaming
02:18live and on-demand to iOS devices.
02:21This gives you an overview of how you can repurpose your streams for delivery to
02:25iOS devices using HLS on FMS.
02:29Next, we'll look at one more delivery method supported on FMS,
02:32Multicast Streaming.
Collapse this transcript
Understanding multicast and peer-to-peer streaming
00:00In addition to HDS, HLS, and RTMP, there is one more acronym you need to know, RTMFP.
00:07RTMFP or Real Time Messaging Flow Protocol is the technology that makes
00:12peer-to-peer communication and multicast streaming possible.
00:16First, we'll take a look at peer-to- peer networking on the Flash platform, and
00:20then I'll show you how it can be used in the enterprise to lower bandwidth usage
00:23with multicast streaming.
00:25RTMFP allows clients to connect directly to one another to exchange
00:29video, audio, or data.
00:31This direct communication minimizes the load on the server and lowers your
00:35bandwidth costs, because the server is only used to make the initial
00:38introductions between peers.
00:40As powerful as peer-to-peer applications can be, it's a more advanced topic, so
00:45we won't be building a peer-to-peer application in this up and running course.
00:48You should know how it works though, so here's a simple scenario.
00:52First, a person who wants to share video or data will connect to the
00:55introduction service on FMS.
00:58FMS then stores their network address and adds them to a specific peer group.
01:02As other people connect to the introduction service, they're added into the peer
01:06group and their network addresses are provided to other members of the group.
01:10FMS then steps out of the way and lets the clients communicate directly.
01:14The FMS server and network don't have to serve the video files or handle the
01:18network traffic after the introductions are made.
01:20RTMFP also powers Adobe's Multicast Fusion technology.
01:25Multicast is a way to deliver video to massive audiences within an organization
01:29while keeping the load on the network manageable.
01:32Imagine an all-hands meeting being broadcast to a large company.
01:35Their internal network would quickly come crashing down if thousands or
01:39hundreds of thousands of people were to tune into the broadcast all at once,
01:43because with traditional streaming, the video data would have to be streamed
01:47directly to each one of them.
01:49Multicast Fusion solves this problem using peer-to-peer connections along with
01:53special multicast-enabled network hardware.
01:56Peer-to-peer connections are used to deliver to those outside of the network
02:00and multicast-enabled hardware is used to efficiently stream to people at their desks.
02:04This approach is best for large organizations broadcasting both internally and
02:09externally and is a huge step forward for delivering media to large audiences in Flash.
02:13When Multicast Fusion was first introduced in 2010, Adobe used it successfully
02:18broadcast their MAX Conference to a massive worldwide audience, as well as
02:23internally to Adobe employees.
02:25Now let's look at how it would have worked for the scenario I just mentioned
02:28where some clients are on the internal network and some are tuning in over the Internet.
02:32First, the publisher broadcasts the live stream to FMS using Flash Media Live Encoder.
02:37Then this multicast stream is sent through the network to a
02:40multicast-enabled router.
02:43When clients want to watch the stream, they connect to FMS.
02:46FMS then makes peer introductions.
02:49Once the introductions are made, clients are connected together either over a
02:52multicast or peer-to-peer over RTMFP and they share the video stream data
02:58directly among the group.
02:59As you can see in this case, there's very little traffic flowing through the
03:02router or the FMS server.
03:04Most of the load is shared among the peers.
03:06Hopefully, these examples demonstrate clearly how multicast and peer-to-peer
03:10networking can significantly reduce the demand for server bandwidth.
03:13This can open up a new range of possibilities for video chat and other
03:16real-time media applications that may have previously been impractical, because
03:21of bandwidth costs.
Collapse this transcript
Choosing a delivery protocol
00:00Now that you've gotten a crash course on the delivery methods available with
00:03Flash Media Server, you may be wondering how to choose which one to use.
00:07In this lesson, I'll give you the best use cases for each and make some
00:10recommendations to help make the decision easy.
00:13Let's start with RTMP.
00:15There are lots of advanced features available with this tried and true delivery
00:18protocol that you can't get with the others.
00:20With RTMP, you can stream live from a webcam directly in the browser, record
00:25video streams on the server;
00:27create richer applications that use server-side ActionScript, use the various
00:32logging and administration features built into FMS, combine video streaming with
00:37real-time communication in the same application.
00:40And it also features inherent content protection using encrypted streaming and
00:45Flash Access, so it can be much more secure.
00:48And it has inherent content protection, encrypted streaming, and Flash Access
00:52support, so it can be very secure.
00:55There are also a couple of reasons you may not want to use RTMP.
00:58Sometimes RTMP traffic is blocked by the server administrator.
01:02Flash isn't supported on iOS, so your custom applications won't run there.
01:07So RTMP is great for most streaming needs and for creating real-time
01:11communication applications such as chat rooms and multiplayer games.
01:16Next, we'll look at HTTP Dynamic Streaming or HDS.
01:20HDS is a very efficient delivery method for both live and on-demand streams.
01:25It's great for high-definition video and video to devices, where you'll need to
01:29switch to lower quality streams.
01:31Since it streams over standard HTTP connections, you can avoid the traffic
01:35blocks you might get with RTMP.
01:37You can serve the streams from a standard HTTP server, so you may be able to
01:42save some money on server costs, since HTTP servers are much more common and
01:47easier to maintain than media servers.
01:49Protected HDS is now available in FMS 4.5, allowing you to encrypt your video files.
01:55It's like a Flash Access light, giving you content protection without the need
01:59for a Flash Access License Server.
02:01One potential drawback to HDS is that you need a special video player to parse
02:06the manifests and piece together the fragments.
02:09Open Source Media Framework and Strobe Media Player, both open source and
02:13free, support this logic.
02:15So you can use those as a starting point.
02:18And HDS is not supported in older versions of Flash Player.
02:21Then there is HTTP Live Streaming.
02:25HLS is not supported in Flash, only on iOS devices and Safari and QuickTime on the Mac.
02:31It has the same benefits as HDS;
02:34it supports high-quality, live, and on-demand streaming and is hosted and
02:38delivered over standard HTTP connections.
02:41To stream live and on-demand video to iOS devices, you'll want to use HLS and
02:46FMS can package HLS streams alongside HDS streams.
02:51So it's not an either/or situation, you can use both side by side.
02:55Protected HLS is now available in FMS 4.5, allowing you to add the same
03:00protection you have on your HDS streams.
03:03The one downside is that HLS is a video-only solution.
03:07To add the interactivity you could get with a Flash application, you'll need to
03:10build a custom iOS app. Next is Multicast.
03:14Multicast is a very specialized delivery solution.
03:17It's the obvious one for enterprise, especially those with networks enabled
03:22with multicast support.
03:24It can also be useful for multiplayer gaming as well as video streaming, because
03:29it provides very low latency.
03:31Other good uses include inter-office videoconferencing, companywide broadcasts,
03:36even Real-Time Financial or News Tickers.
03:39And finally, there is RTMFP, Adobe's peer-to-peer protocol.
03:44RTMFP has similar use cases to RTMP.
03:48Both RTMP and RTMFP deliver live and on- demand video, audio, and data streams.
03:55They both provide low, latency real-time communication.
03:58You can use either one to power applications such as videoconferencing, text
04:02chat, live broadcasts, multiplayer games, and even live support.
04:07RTMFP however is a natural choice for real-time communication in streaming when
04:12you need massive scale.
04:14It eliminates the need for huge server farms and network infrastructures to
04:18share large amounts of data.
04:20RTMFP applications can be quite complicated to develop though, and the developer
04:24community around it is currently pretty small.
04:27So the learning curve in getting an RTMFP app going can be steep.
04:31So hopefully that gave you some guidance in choosing the right delivery method.
04:36Next, let's review some key terms and concepts that you'll likely run into when
04:39publishing video with Flash Media Server.
Collapse this transcript
3. Learning the Terminology of Streaming Media
What is a codec?
00:00What is a Codec?
00:02Codec is short for Coder/Decoder and refers to the process of taking raw
00:07data and compressing it.
00:08The formula the encoder uses to compress the data is referred to as the Codec.
00:13For example, Flash uses H.264, VP6 and Sorenson Spark for video, an AAC, Speex
00:21and MP3 and also Nellymoser for audio.
00:24AAC audio does require an extra license when used for live streams and we'll
00:28discuss that later when we set up our live video example.
00:31Now different Codec's compress the data in different ways, so video file
00:35compressed using H.264 may have a smaller file size than a VP6 video, but the
00:41image quality might be about the same there can be other differences in Codecs as well.
00:45For example, VP6 supports an alpha channel for video transparency, where H.264
00:51does not, but you can take advantage of hardware acceleration with H.264, not so with VP6.
00:58Since HDS and HLS streaming only work with videos that use H.264 for video
01:04and AAC for audio, that's what we'll use for all of the video examples in
01:08this course.
Collapse this transcript
Understanding delivery methods
00:00With a wide variety of delivery methods available on FMS, it's easy to get
00:04confused by all the protocols and streaming methods.
00:07Let's take a moment to define some of these key terms.
00:09First, what is a Delivery Protocol?
00:12In this course, I refer to delivery protocols a lot.
00:15The technical definition of a protocol is a set of computer rules that
00:19provide uniform specifications, so that computer hardware and operating
00:23systems can communicate.
00:25In our usage for video streaming, a delivery protocol refers to the route video
00:30data takes to get to you and the rules that need to follow to get there.
00:34For example, HTTP dynamic streaming videos are sent over HTTP, and they must
00:41be broken into fragments before sending, then you put them back together for playback.
00:46FMS supports RTMP, RTMFP and standard HTTP protocols.
00:53The technical details of these protocols were discussed in depth in Chapter 2 of this course.
00:58Once a delivery protocol is established, then there are various methods of
01:03sending that video data over that connection.
01:06Let's look at two of those methods, Progressive Delivery and Streaming.
01:10Progressive Delivery or Progressive Download is the most basic form of video delivery.
01:15The file is served from a standard Web server through an HTTP request, just like
01:20a normal web page or any other downloadable document.
01:23This is the method that sites like YouTube and Vimeo use for serving their videos.
01:27When the video is played using progressive deliver, the entire video file first
01:32begins to download to the viewer's hard drive and then playback starts.
01:37The video will begin to play when enough of it has downloaded to the
01:40viewer's hard drive;
01:41this amount is referred to as a buffer.
01:43Progressive Delivery although delivered over the same protocol as HTTP streaming
01:48methods, is not as efficient.
01:51Streaming delivery consumes less bandwidth than progressive delivery, because
01:55only the portion of the video that's watched is actually delivered.
01:58There are two other downsides to progressive download that make it less
02:02attractive than streaming, it's not possible to seek to points in the video that
02:06haven't been downloaded, and you can see this here on Vimeo.
02:11When I click on this video and start to play it, I will click forward ahead of
02:15the buffer and try to jump to that point and it won't let me do that.
02:21(music playing)
02:30And the video data is cached on the user's computer and could be retrieved;
02:34now this is not good for copyright and sensitive content.
02:38So, moving on to streaming, streaming Delivery is a concept that sometime is misunderstood.
02:43The technical definition of streaming is data being transmitted in a continuous
02:48flow while earlier parts are being accessed.
02:51Now there are two approaches to streaming, RTMP is considered to be true streaming.
02:56There is an open connection between the server and the client and then data
03:01flows continuously between the two, the bits are discarded after they're viewed.
03:06Then there's HTTP streaming where video data is requested in small fragments
03:11from the server and then put back together into a stream by the client when
03:14it's received, and it plays like a true stream, and can even support live video
03:19with a bit of a delay.
03:21One key difference is what happens to those bits, instead of being discarded
03:25as with RTMP streaming, they are cached on the client, so HTTP streaming isn't as secure as RTMP.
03:33There are two formats that support HDTV Streaming with Flash Media Server, HDS
03:38for playback in flash and HLS for playback on iOS.
Collapse this transcript
What is a server-side application?
00:01Generally when we refer to Server-Side Applications we're referring to code that
00:05runs on a server rather than in the browser.
00:08For our purposes a Server-Side application is an application that runs on
00:12Flash Media Server.
00:13Server-Side applications are ActionsScript communication files and have
00:17the extension .asc.
00:19The server application is written in Server-Side ActionScript, which is like
00:24ActionScript 1.0, but it runs on the server, rather than on a client.
00:28You can use server-side code for logging, to control access to applications,
00:33perform certain operations when users connect or disconnect, create playlists or
00:39even connect to external data sources.
00:42FMS installs with four pre-built Server- Side applications also called Services
00:47and they're here in applications inside of the Flash Media Server folder, and
00:52they are live, live packager, multicast and vod.
00:58Each service enables a different type of streaming;
01:01you can create your own custom Server- Side applications with every edition of
01:04FMS, except the streaming server.
Collapse this transcript
4. Installing Flash Media Development Server
What platforms are supported?
00:00In this lesson I'll talk about what Operating Systems Flash Media Server
00:03officially supports.
00:05Flash Media Server 4.5 is the first release of FMS that is strictly 64-bit
00:09compatible, previous versions would run on 64-bit, but in 32-bit mode.
00:14Now you must have a 64-bit operating system.
00:16The one exception to this is the development server, it is still offered in a
00:2032-bit version, but Adobe does not recommend using in production, only for local
00:25development, since it's not as robust as the 64-bit version.
00:28The efficiently supported platforms are listed here.
00:31For the demos in this course, I'll be running Windows 7 Professional 64-bit,
00:35and as you'll see during installation, there are some security issues you'll
00:38need to work around.
00:39Other than a couple of extra steps to handle those issues, installation of FMS
00:43is really pretty simple.
00:44So provided you are on a compatible operating system, let's go ahead and
00:47install FMS.
Collapse this transcript
Installing Flash Media Server 4.5
00:00In this lesson I'll walk you through the process of installing Flash Media Server 4.5.
00:05We'll install the free development edition of the server.
00:08So first you'll need to download the installer from adobe.com, you can follow
00:13this link and it will take you to the FMS homepage, you'll then be prompted
00:17to enter an Adobe ID.
00:19If you don't have one, you can make an account, and then you can download the
00:23free development edition.
00:24I have already done this, and it is in my Downloads folder.
00:28Now before you begin installation, be sure to uninstall any previous versions of
00:34FMS that you may have installed, you want to back up your applications folder if
00:39you have any custom applications there, and also your settings folder, if you
00:43made any changes there.
00:44Then you can uninstall FMS by following the instructions in the FMS documentation.
00:49Now before we start this FMS installer, because Windows 7 has some crazy strong
00:55security settings, we need to be logged in as an administrator, or the installer
01:00will be blocked from running, it may not appear to be blocked, but it won't
01:03actually install all the elements that we need.
01:05Now in my early testing of FMS 4.5, this was not documented, so I lost a good
01:10solid day trying to figure this out, so hopefully this will save you some time.
01:13Then you may think that you're running as an administrator right now, but in
01:17fact, admin access is turned off by default in Windows 7.
01:22So we'll need to run some code on the command line to be able to run our FMS
01:26installer as an administrator.
01:28So this is pretty straightforward to do.
01:29First thing we do is go to our Windows menu and start typing commands in the
01:35search bar down here and here's the Command Prompt.
01:38Now before we click on it, you want to make sure you right-click on it and
01:42choose Run as administrator, and yes, we do want to let the following program
01:49make changes and here we are on the command line, and we just need to add a few
01:53simple commands here.
01:54So we want to type in net user administrator and then space forward slash
02:03active colon yes, so we're activating the administrator and that command is
02:09completed successfully, and there's one more thing we need to do which is put in the password.
02:14So net user administrator, and then we can type in a password here, and I'm
02:24using the password that is currently being used for my account on this computer,
02:28and that command has been completed successfully, and we now have the permission
02:32set that we need to install Flash Media Server.
02:36So we can close the command line and we want to make sure that we quit any other
02:39open programs before we begin our installation, so I still have PowerPoint open
02:44here, and we'll close that.
02:46We don't just double-click on this, we also want to run the installer as an
02:50administrator, so we'll right-click on it and choose Run as administrator, and
02:56we see the FMS splash screen briefly, and we did close all other applications,
03:01just reminding us to do that.
03:03We click Next and now we're being prompted to agree to the terms, which I will
03:08do, Accept the agreement, click Next, and here we're being asked for our serial number.
03:15Since we're installing the development server, we won't need one, we can just
03:18leave this field blank and click Next, and this screen confirms that we do not
03:23have a serial number, so we're just installing the development edition.
03:26So we can click Next, and here we can choose where to install the FMS files on our computer.
03:33The default location on Windows is in the Adobe folder inside of the Program
03:37Files folder, and I recommend just leaving it at the default, so we'll go
03:41ahead and say Next.
03:42Now I did previously have a version of 4.5 on this computer that I had
03:46uninstalled and apparently when you uninstall FMS, it leaves the empty folders
03:51behind, so we can just say Yes, we do want to overwrite those contents.
03:55Now we're being asked whether we want to install an Apache server along with
03:59FMS. You will want to do this if you plan to use HTTP Dynamic Streaming, HTTP
04:06Live Streaming, or if you want to use the default web pages to test your
04:10installation, which will be doing throughout this course.
04:13So we'll go ahead and say Yes, by leaving Apache checked and clicking Next.
04:18Here you can decide if you want a shortcut in the Start menu or if you'd like it
04:21to appear elsewhere, you can make your choice and then click Next.
04:24I am just going to leave the default, and here is where you really need to pay attention.
04:29Here you need to enter administrator, username and password, and you'll need
04:33this for logging in into the administration console, which we will do later in the course.
04:37So choose the usernames and password here and write it down.
04:42I will just use admin and choose a password, and click Next.
04:48Finally, you need to specify what ports you want FMS to use, unless you have
04:52a very specific reason for doing so and you are a server administrator, I
04:57recommend using the default ports of 1935.80 for the server and 1111 for the
05:03Administration Server, so we'll click Next, and here we are presented with a summary screen.
05:09Everything looks to be in order, so we can go ahead and start the installation
05:13by clicking Install.
05:14Now the installation takes a few minutes.
05:17Okay, here we have a few more choices;
05:20we can launch the start screen, which I'm going to uncheck for the moment, so
05:23we're going to do that manually in the next lesson.
05:26You want to start FMS 4.5 right now, Yes, we do want to do that, and finally,
05:31ask if we want to start FMS when our computer starts, and I recommend saying Yes
05:36to this, so you have FMS launched at Startup, because you can always turn it off
05:40later and it doesn't use up very much computing power to run in the background
05:43when you're not using it.
05:44So we'll leave those two items checked and click Finish.
05:49Now FMS is installed, but as I mentioned, because of the tight security features
05:54of Windows 7, there's one last thing that we're going to want to do to make sure
05:58that FMS will run properly every time we restart our computer.
06:01So we'll go ahead and navigate to where FMS was installed, and that is on our
06:07computer, in Program Files, Adobe Flash Media Server 4.5.
06:13Now we want to scroll down to the actual application files here, and there are
06:20four of them, FMSAdmin, FMSCore, FMSEdge and FMSMaster.
06:27These four we want to have always run as administrator, so we'll have to choose
06:32each one individually and change a setting here under Properties.
06:37
06:37Under Compatibility, we want to always run this program as an administrator.
06:41Now this is checked for us right now, but we just want to double check that each
06:47one of these is indeed set to run as administrator every time it starts up.
06:51So we'll say OK, this one is as well, and I think all four will be, and if you
07:08do not have this checked, then when you do restart your computer, FMS and the
07:14Apache server that are installed along with it may not run correctly, so we are
07:18all set with these files, and we are all set with our installation.
07:21Now that was pretty easy and now that we do have FMS installed, we are ready to
07:26move onto the next lesson, where we'll test our installation to make sure it's
07:30ready to start streaming.
Collapse this transcript
Testing your installation
00:01Okay, so we have now installed FMS and we're ready to test it out.
00:05In this lesson I'll introduce you to your new best friend, the Flash Media
00:09Server start screen and we'll verify that FMS is successfully installed and
00:14running, by testing RTMP and HTTP streams, as well as a Live Webcam Capture.
00:21Now that we have FMS installed.
00:22How do we know that it's actually working?
00:24Well, it used to be that we had to go into Flash, write a simple application
00:29that opened up an RTMP connection, and then try to play a video, and that was a big pain.
00:34So thankfully, Adobe has created a preconfigured web page called the Flash Media
00:39Server Start Page, and this page allows you to instantly know if FMS is running,
00:45and it let's you test a variety of different streams and protocols, including
00:49grabbing a Webcam and testing that out.
00:51It really is a simple, but invaluable tool.
00:54Now you will need the most recent version of Flash Player and at the time of
00:59this recording that's 10.3.
01:01So this start page is located here inside of the webroot folder, in our Flash
01:06Media Server install folder.
01:08So I'll open up webroot, and it's actually index.
01:12So this means this is our default page for our Apache Web Server.
01:16We can launch it a couple of different ways, one, I could just double-click on
01:20it, or you can go down to your browser here and I have Internet Explorer, and
01:25you can type in localhost http:// localhost, and it will launch this page.
01:38So here if the video plays for you, you are in business, FMS is installed and running.
01:43If you get an error message, there is a problem with your installation, or FMS
01:48is simply not running.
01:49So you can try relaunching FMS manually, and then reloading this page, and I'll
01:54show you how to do that.
01:55You just go down to your window and navigate to FMS, under All
02:00Programs>Adobe>Flash Media Server and here we can manually start and stop the server.
02:06So if you started up, you go back to this page and reload it, and you still
02:10don't have video, you're going to want to refer to the FMS documentation
02:14for additional help.
02:16So the start screen lets you test various protocols and sources, from HTTP
02:21Dynamic Streaming to RTMP Dynamic Streaming, and even HLS, which won't work of
02:27course in this browser, but it will work on Apple devices.
02:31We'll get deeper into that in upcoming lessons, so for the purposes of this
02:35lesson, it's safe to assume that HLS is working, since the other methods are.
02:39So we'll take a look at these, starting with the RTMP, which is what we just saw.
02:42We watched a single bit-rate of that.
02:45Let's look at the Single Bit-rate of HTTP streaming.
02:53That one is indeed working as well and you'll see we have these nice new graphs
02:57that they've added which let us know the Current Frame Rate and the Buffer Size
03:02and these can be really handy for troubleshooting and refining your encoding.
03:05So let's switch over now to the Interactive tab and here we're going to access my webcam.
03:12And it's asking me first for my permission, which I will give, I'll say, Allow,
03:17and here we are, and we can see that I can immediately Publish this if I like,
03:22and Play it back right here in the start screen, it's very simple.
03:26So let's go ahead and do that and you'll see what we're doing here, this is kind
03:30of cryptic probably at this point, but we're using the live service to do this,
03:34and I will be demonstrating this later on.
03:38So, we'll Publish that, and then we can Play it back.
03:44And there it is, and there is a bit of a delay, not much, and we are streaming a
03:49live video from webcam right here, ready to go.
03:54So now that we know FMS is running properly, it's time to dive into working with
03:58streams and applications.
Collapse this transcript
5. Streaming On-Demand Video with RTMP
What is the VOD service?
00:00FMS ships with an application called the VOD service, which you can use to start
00:05streaming video files right away without any server-side code or configuration.
00:09This is the service that the FMS start page uses to play that very first sample
00:13video we saw when we tested our FMS installation.
00:16The VOD service is a pre-built application that lets you stream video files over RTMP.
00:21FMS applications are stored in the Flash Media Server folder under appropriately
00:26enough applications.
00:27Since you'll be needing to access this folder a lot, you might want to take
00:32a moment to create a shortcut for it on your desktop or in the favorites in Windows.
00:35Now once we're here in the applications folder, you'll see the VOD service.
00:39The directory structure of this application is slightly different from other
00:43applications, as you'll see later when we build our own custom application from scratch.
00:46So inside of VOD folder here you see we have a folder called media, and this is
00:51where you put the video files that you want to stream.
00:53Inside here are some sample videos that we use to test our installation back
00:58on the FMS start page.
00:59So here is a diagram of how the VOD service works.
01:03First, you put the videos into the media folder, when a SWF file such as, Flash
01:08Media playback requests that video, it first opens up in RTMP connection, to
01:12the FMS server, then once connected, it requests the specific video file from the VOD service.
01:19FMS then streams that video over RTMP to the client SWF and the video plays.
01:23Now just to get the hang of how VOD service works, let's copy our own video here for testing.
01:31In the supplied Exercise Files for this lesson, you'll find explore02.f4v.
01:36Let's copy that over to the applications>vod>media folder.
01:41So inside of 05_01, here it is, and I'll right-click and Copy that, and then
01:47over here in the vod> media folder, I will paste it.
01:51Now remember, we are inside of the program files folder, so we need
01:54administrator access to copy things here.
01:56So I'll go ahead and hit Continue, and of course, you can use your own video
02:01here instead of our sample, just make sure that it's in a Flash compatible
02:05format, such as, FLV or F4V.
02:06Now that you've seen how the VOD service works and copied the video to the right
02:11place, we're all set up to stream a video.
02:14All we need now is a video player application.
02:17Luckily for us, Adobe has packaged a sample video player with FMS.
02:20Next, we'll use it to play the video, we just put in this vod>media directory.
Collapse this transcript
Streaming an on-demand video via RTMP in a sample player
00:00Now that we've placed our video into our vod>media directory, we're ready to play it.
00:05FMS ships with a sample video player we can use for testing, saving us a lot
00:09of time and effort.
00:10This video player is actually a version of Strobe Media Playback, a free
00:14open-source video player that was built by Adobe.
00:17Let's go ahead and stream our video using that player.
00:19So you can find it here inside of the Flash Media Server folder
00:23samples>videoPlayer.
00:26And we can just double-click on video player and it opens it in our browser.
00:29It will play the sample video.
00:30We'll pause that, and now we can scroll down to enter our own URL that we'd like to stream.
00:38So in this case we do want to use the RTMP protocol and it is also localhost,
00:43because everything is running here locally, vod service, and mp4, but we need to
00:49put this before any F4V videos, FLVs don't need this, explore02.f4v.
00:58Now we can click Play Stream.
01:01(video playing)
01:10And it's that simple.
01:11Now as I said we're working on a locally running Flash Media Server, so this
01:15stream and the video player itself are not accessible over the web.
01:19This is fine for learning FMS, but when you're ready to stream videos out to the
01:22world, FMS will need to be on the web- accessible network, and your video player
01:27application needs to be on a web server.
01:28In that case, you'd enter the domain name, or IP address of the server that's
01:33running FMS, instead of localhost, and that might look something like this.
01:37Here fms.learnfromlisa.com is where FMS is running, and we're using vod and
01:43pointing to our video.
01:45For more information about publishing video and creating video players for web
01:49video delivery, you can refer to my other lynda.com course, Publishing Video on
01:53the Flash Platform, where I cover this in-depth.
01:56As you can see, streaming on-demand video with FMS is pretty easy to do
01:59right out of the gate.
02:00Next, let's look at how to configure a multi-bitrate RTMP stream one that's
02:04optimized to the viewers connection speed.
Collapse this transcript
Publishing multi-bitrate on-demand streams via RTMP
00:00No matter how much you plan and optimize, you can't guarantee that your videos
00:03is going to stream flawlessly to every viewer.
00:06Their Internet connection speeds fluctuate and they often multitask stealing
00:10bandwidth away from your stream.
00:12One way to alleviate this problem is by using Dynamic Streaming, also referred
00:16to as Adaptive Streaming.
00:18Dynamic Streaming detects changes in viewers' bandwidth and switches among
00:22streams of different bitrates giving them the highest quality they can handle at that moment.
00:28Flash supports both RTMP and HTTP dynamic streaming.
00:33In this exercise, I'll show you how to set up RTMP dynamic streaming
00:37for on-demand content.
00:40The first step is to create a list of available video bitrates in a format
00:44that our video player application can understand.
00:46In almost all of the exercises in this course, we are using a player based on
00:50the Open Source Media Framework or OSMF.
00:53OSMF provides all the logic for reading our lists of bitrates.
00:57Detecting in the bandwidth of the player and deciding which video they will get.
01:01It listens constantly for changes in connection speed and can switch back and
01:05forth seamlessly between bitrates when needed.
01:08If you build a player from scratch rather than using an OSMF-based player,
01:11you'll have to handle all of this logic yourself.
01:14The list of bitrates that we pass in for dynamic streaming is saved in an f4m
01:19file, special XML file format.
01:22So let's start by opening up our explore- rtmp.f4m file included in this lesson's
01:28exercise folder and we'll take a look at how it structured.
01:31Now I'm going to open this up in Dreamweaver, but you can use any text editor.
01:35First, we're specifying the document format, Adobe calls these multi-bitrate
01:40playlists manifests, but I try to refer to them as playlists, to avoid getting
01:45them confused with the manifest files used in packaging HTTP streams, which is a different thing.
01:51Next, we tell the player that this is Dynamic Streaming.
01:54We set a baseURL for each of the streams and then tell the player what Type of
01:59file this is, if it's live or recorded.
02:02Finally, we enter the URLs of each bitrate video.
02:06Note that if these are f4v files, we'll need to add MP4 before the file name.
02:10We then tell the player what the bitrate is for each file and this is why I
02:15always recommend tagging the bitrate onto your file names.
02:18Even though it might seem like a bit of a hassle sometimes, it's certainly
02:21better than having to analyze a video later, trying to find out its bitrate.
02:25So this is our dynamic streaming playlist.
02:28Now we can put it into the webroot of our FMS server, so let's do that now.
02:35Here in our exercise files I will Copy it, and then we'll navigate to the right
02:39place, Flash Media Server>webroot, and it needs to go into the vod folder.
02:47Here I will Paste it, and we'll continue to allow this copy here into the program files.
02:55And the next thing we need to do is upload our video files to the right place
03:00and I have three of them here, the ones that we just had in our list, 500
03:03kilobits, 1000 kilobits, and 1500 kilobits.
03:06So we'll go up two levels here to applications, because this is RTMP streaming,
03:12we want to put it right into the vod folder, inside of our applications.
03:17And I will select all three of these, Copy them, and we want them to go into media.
03:24So I'll open this folder up, and Paste them in.
03:27Okay, so our video files are in place and our multi-bitrate playlist is in
03:36place, now we go to our sample player.
03:40Go back up to samples>videoplayer and double-click on our videoplayer, which
03:47will launch it in a browser.
03:48Pause that default video, and now scrolling down here we can now enter the
03:54URL for our playlist.
03:56This is http, because it's being served from the webroot, localhost, because
04:02it's local, and vod, because it's in the vod folder.
04:06and then finally the file name. f4m.
04:10Okay now, we can go ahead and play the stream.
04:13we'll just click on Play Stream.
04:14(Tom Mueller: Welcome to this week's episode of Explore California. I'm your host,)
04:19 (Tom Mueller, and this week we're going to take you on a tour of--)
04:23Now when I noted that playlist, the player detected my bandwidth, decided which
04:27video it would be best for me and started playing that one.
04:30And because everything is running locally here, I'm sure that this is the
04:33highest bitrate video.
04:35So you've now played a single on- demand stream and configured multi-bitrate
04:39RTMP dynamic streaming.
04:41Next, let's set up a broadcast and test out live streaming.
Collapse this transcript
6. Streaming Live Video with RTMP
What is the live service?
00:00Next, we look at the Live Service, which you can use to start streaming live
00:04from a webcam right away without any server-side code or configuration.
00:08This is the service that the FMS start page uses, to broadcast and Play Live
00:12Stream under that interactive tab there.
00:14Like the VOD Service, the Live Service is a pre-build application that ships with FMS.
00:20And it supports standard RTMP streaming.
00:22So the structure of the live application directory on FMS is slightly different
00:27than with a custom application.
00:28Let's take a quick look at that.
00:32So inside of Flash Media Server, applications, live, now you see here there's no
00:37need for a streams or a media directory since the stream is created dynamically
00:41when you start to capture.
00:42Unless you specify otherwise, that stream is not stored on FMS it just passes
00:47through to connected viewers.
00:48And if you're familiar with other video delivery platforms, you may have heard
00:52this called a Publishing Point.
00:53So lets take a look at a diagram of how the Live Service actually works on FMS.
01:00First, the broadcaster has an encoding workstation setup that's getting video
01:04data from a Webcam or a capture card, and is running encoding software such as
01:08Flash Media Live Encoder.
01:10In the software, they connect the FMS over in RTMP connection, and then begin
01:14sending a Live Stream to the Live Service.
01:17Then when a viewer opens up a video player application in Flash Player and
01:21requests that stream from the Live Service, the stream begins to play.
01:25So that's a high-level view of Live Streaming on FMS.
01:28That workflow being understood, we are now ready to start broadcasting and
01:32playing a Live Stream.
Collapse this transcript
Streaming a live video from your webcam
00:00In this lesson, we will broadcast a Live Stream from a webcam over FMS using
00:05Flash Media Live Encoder.
00:07For this exercise, you should have Flash Media Live Encoder 3.2 or later,
00:11installed, and have a webcam or other video input connected to your computer.
00:16Flash Media Live Encoder is a free download available from Adobe.com, and there
00:20are both Mac and PC versions available.
00:23This software will capture the video image from a connected device such as a
00:27webcam, video camera or other hardware, such as the capture card.
00:31It then takes that video and encodes it into a Flash compatible format and sends
00:35that stream to FMS, where it's broadcasted to the viewers.
00:38So let's get started.
00:39I will go ahead and open up Flash Media Live Encoder.
00:41Then you will see that it automatically detects any connected video sources and audio sources.
00:51And when you launch Flash Media Live Encoder, you'll probably see some previews
00:55up here of your webcam, I like to turn those off, because they are kind of
00:58distracting, but just to see now I am here.
00:59So I will turn that off and we can configure various settings here, our bitrate,
01:08our Format, Frame Rate and so on, and you notice that we are using VP6 and MP3,
01:12because we will be broadcasting an FLV file.
01:14And you can also configure up to three different files with different bitrates
01:18and sizes and encode them all simultaneously.
01:22This allows you to use RTMP Dynamic Streaming
01:24to be sure the viewer gets the appropriate bitrate stream for their
01:27available bandwidth.
01:28And we will be doing this in an upcoming lesson.
01:30And I do address all of these encoding settings in more depth in my course,
01:34Publishing Video on the Flash Platform.
01:36But for the purposes of this exercise, we will just stick with the default
01:39encoding settings now.
01:40So over here on the right, we tell the encoder where to send our stream.
01:45We want to send it to FMS running locally, and we will use the Live Service.
01:49So here we will enter the RTMP address, localhost/live and we will give our
01:55stream the name, livestream.
01:57You can also save the stream to a file here on your local machine.
02:00This is good for archiving and backups, but be sure you don't fill up your hard drive.
02:04You can set limits to file size and duration, which will definitely help
02:08avoid that problem.
02:09And finally, you will see this little check box down on the lower right, DVR Auto Record.
02:13That allows viewers to pause and rewind the Live Stream.
02:17And that is a more advanced feature, so we will leave that unchecked.
02:19The first thing we want to do is connect FMS to be sure that we have the correct
02:24URL and that FMS is running.
02:25So we will click Connect, and we can see down here that we are
02:31successfully connected.
02:32So we are now ready to start our stream.
02:35I will go ahead and click Start, and we immediately get some feedback here in
02:40the log, then are video and audio encoding has started.
02:44So I am now broadcasting my webcam to the Live Service on FMS, running on my local computer.
02:49So now how do I view the stream?
02:51Well, we just need a Video Player application.
02:53And in the next lesson, we will switch over to our trusty sample Flash Video
02:57Player and view our broadcast.
Collapse this transcript
Testing your live RTMP stream in a sample player
00:00Now that we have a Live Stream being encoded in Flash Media Live Encoder and
00:03being broadcast by FMS, we can view it in a Video Player Application.
00:08In this lesson, we will turn again to our Sample Video Player that ships with
00:11FMS for testing, and then we'll switch to broadcasting in F4V, so you can
00:17understand how the URL is handled differently from an FLV.
00:20So let's go ahead and navigate to our Sample Player, so we will minimize our
00:25Encoder, and in the Flash Media Server 4.5 folder, under samples, there is our
00:31videoplayer, we will open that up and we can double-click the videoplayer to
00:35launch, and we will pause that default video.
00:40And now we can just enter the URL of our Live Stream, so rtmp://localhost and
00:50it's using a live service and our stream name is livestream.
00:54And you can click Live here, it doesn't seem to really make a difference, but
01:00it always feels good to click Live, and I am going to go ahead and Play this
01:04Stream now, and you'll notice there a couple seconds delay, so I won't keep it
01:07on the screen for too long here.
01:17Now we can go back into our Encoder, and we want to make a change to our video
01:24format, just to show you how it's done here.
01:27So I will Stop our encoding, and we are going to encode an F4V this time.
01:32So we need the H.264 codec for video and AAC for audio.
01:39And one note about audio codecs in version of Flash Media Live Encoder after 3.2
01:45on the PC, AAC may not be an option for you.
01:48It will need to be purchased from main concept as an add-on, due to
01:52licensing restrictions
01:54If you do your encoding on a Mac however, you may have AAC available as
01:57it's part of QuickTime.
02:00Now in order for us to successfully play this H.264 video, we need to tag mp4 at
02:06the beginning of our stream.
02:08And this let's FMS know what type of stream is coming in and that's all we need
02:11to do, now we can click Start and we will see that we are indeed successfully
02:17encoding video and audio, and we can switch back to our Videoplayer.
02:28And we will enter the URL to this video, it's very similar,
02:31rtmp://localhost/live service, but this time we tag mp4 at the beginning of our
02:39file name, so it's mp4:livestream, and again, I will test this out real quick.
02:56So that was an H.264 video.
02:58So it was a little higher quality than the VP6.
02:59So you have now successfully setup and tested a Live Stream using the
03:04Live Service on FMS.
03:06As you can see, it works nicely with Flash Media Live Encoder and is fairly
03:09straight forward to set up.
03:11When you're ready to broadcast to the world, you would embed a videoplayer
03:14SWF, such as Flash Media Playback into your web page and use that to play your Live Stream.
03:19I covered this in more depth in my other course, Publishing Video at the Flash Platform.
03:24Next, let's see how we can provide smoother playback by using RTMP
03:28Dynamic Streaming.
Collapse this transcript
Publishing multi-bitrate live streams via RTMP
00:00Earlier in the course, we configured RTMP Dynamic Streaming for on-demand content.
00:05This allowed us to deliver multiple- bitrate streams and have our Flash Video
00:09Player detect the viewers bandwidth and then give them the best stream that they
00:13can play at that moment.
00:15Now we are going to do the same thing for a Live Stream.
00:17First, we will need to make a quick change in our encoding settings in FMLE.
00:21So back here in the Encoder, over here we can choose to
00:26encode multiple-bitrates.
00:28Let's encode 200, 500 and 800.
00:30So using the dropdown menu here we can choose 200, and then we check this box
00:39and we will do 500 and finally, 800.
00:44You can also mix Output sizes as well but, I want to keep them all consistent.
00:48You will need to have enough bandwidth to send out all three of these streams
00:52at once to FMS and that's definitely an important consideration, especially, if
00:57you're broadcasting on location and don't have a fast reliable Internet connection.
01:01And we need to do one other thing here that isn't well documented.
01:04Each of these three streams needs to have a unique name.
01:08And can have FMLE create these names for us when we start to broadcast by adding
01:13a special character after the file name.
01:15So we just add % i, i for integer.
01:20And this will create three unique stream names, livestream1, livestream2, and livestream3.
01:25And let's remember that as we go to configure our playlist, so why we are still
01:30here we will go ahead and click Start and start broadcasting.
01:33And now let's take a quick look at that playlist.
01:37In this lessons Exercise Files, we have rtmp-live.f4m.
01:44Go ahead and double-click that and it will open up in Dreamweaver.
01:47You can use any text editor.
01:49This is a very simple file, and again, we have our manifest file type and our ID
01:55and our baseURL this time is pointing to the live service, instead of VOD.
02:00We are still using MP4 files and we are streaming 3 bitrates, 200, 500, and 800.
02:07And those file names that are being created by FMLE, automatically are
02:11livestream1, livestream2, and livestream3.
02:14Now we are ready to give this a test, so we will go ahead and close this.
02:18And we can copy this file and paste it into our webroot.
02:25To keep our webroot orderly, let's paste it into the VOD folder.
02:28I will right-click and paste so I paste it in here and now we are ready to
02:34go over to our Sample Video Player and test it.
02:36So we will go up a couple of levels to samples>videoPlayer and launch it.
02:46Now we just need to enter the URL of that playlist, and it's
02:51http://localhost/vod, and it was rtmp- live.f4m, these are Live Stream, so we
03:05will check Live and Play the Stream.
03:08And you should see me again with a little bit of a delay, so I won't keep it
03:11open for too long, let's try it.
03:23There was some latency there as you could see, but it is now an RTMP Dynamic
03:27Stream, which will allow our player to switch bitrates as needed, to keep the
03:31stream running smoothly.
03:32So you are now familiar with the various methods of RTMP Streaming,
03:35both on-demand and Live.
03:38Next, we will get our hands on one of the newer Flash video technologies,
03:41HTTP Dynamic Streaming.
Collapse this transcript
7. Streaming On-Demand Video with HDS
Preparing video files for HDS delivery
00:00In this lesson I get you started streaming on-demand video over standard HTTP
00:04connections with FMS.
00:07This is referred to as HTTP Dynamic Streaming or more concisely, HDS.
00:13As I'd mentioned in the introduction to HDS earlier in the course, FMS has some
00:17valuable features that make streaming video over HTTP more efficient and that
00:21now includes real-time packaging of content.
00:24Before FMS4.5, you had to preprocess your on-demand video files, running them
00:30through a command line utility that broke them into fragments and created
00:33associated manifest files.
00:35And then you upload those files to FMS for streaming.
00:38You can still do it this way but now, FMS4.5 supports real-time packaging
00:43for those fragments.
00:44This all happens on the server and you don't need to add anything to your workflow.
00:48There are a couple of requirements for the video files themselves to be
00:52compatible with HDS packaging.
00:54They need to use H.264 for the video codec and AAC for the audio codec and they
01:00need to be saved as f4v files.
01:02All you need to do is place these f4v files in the webroot vod directory, in FMS.
01:09So FMS ships with these sample files here, but we're going to place our own video;
01:13explore02.f4v here to test.
01:18And we'll navigate to our Exercise Files for this particular lesson, 07_01 and
01:24the video file we'll use is explore02, so we will copy this and go back to our
01:31vod folder and paste it.
01:36And we do want to confirm copy.
01:38Now this is the same video file that we used earlier in the RTMP example.
01:43But it now needs to be here in the webroot for HTTP Streaming.
01:47I did use the same video file so you could see how the same assets can be used
01:51for both RTMP and HTTP Streaming.
01:54Okay, so now that our video is ready for real-time packaging, for playback to
01:58Flash Player, let's give it a test.
Collapse this transcript
Streaming on-demand video via HDS in a sample player
00:00Now that we have our prerecorded video file from the right place in FMS, we can
00:04stream it in Flash Player in a browser.
00:07Now we'll use our sample videoPlayer inside of Flash Media Server Samples
00:13videoPlayer, we'll pause the default video and scroll down to our URL field.
00:24And now we just want to enter the URL of our manifest file here.
00:27So its http:localhost, instead of just VOD we need to specify that we want the
00:35packaged version of the stream.
00:37So it's hds-vod, and then the file name, .f4v, and then tag down to the end of
00:47this as f4m, to specify that we want the manifest file for the stream.
00:52So we'll go ahead and click Play Stream.
00:54(Tom Mueller: Welcome to this week's episode of Explore California. I'm your host,)
01:00 (Tom Mueller, and this week we're going to take you on a--)
01:03So what's happening when we pass this manifest in, our videoPlayer is grabbing
01:07all the information about our stream from that manifest, and then it begins to
01:12request the video fragments it needs to start playing the on-demand stream.
01:15Now remember, unlike RTMP streaming HTS requires a lot of extra logic in the
01:21videoPlayer to interpret or parse the manifest, and then to properly play the
01:25fragments strung together.
01:27OSMF based players, such as Flash Media Playback or Strobe, which is what's used
01:32here, have that extra functionality built in.
01:34So you've now successfully set up an on- demand stream using HTS to Flash Player.
01:40This will allow you to stream to Android powered devices, Flash Player and to
01:43AIR over standard HTTP connections.
01:46For iOS, there are a couple of tweaks and a different playback method which I'll
01:50cover later in the course.
Collapse this transcript
Publishing multi-bitrate on-demand streams via HDS
00:00HTTP Dynamic Streaming or HDS is an efficient way to get on-demand video to a
00:05wide audience, including mobile devices that run Flash Player, while still
00:09ensuring that they get the right bitrate stream for their connection speed.
00:13This can be especially useful for devices as they're often on unreliable
00:16Internet connections.
00:18In this chapter, we'll create a multi- bitrate playlist to take advantage of
00:22this useful feature.
00:23The file format for HDS multi-bitrate playlists is different from the format
00:28that we used for RTMP.
00:29Because of this, Adobe has included a tool that helps you create these manifest files.
00:34This tool is called the Set Level Manifest Generator.
00:38It has a cryptic name, but what it does is create multi-bitrate playlists in a
00:43new format referred to as a Set Level Manifest.
00:46In the past if you had content encoded at various bitrate that you wanted to
00:50use for dynamic streaming, you would create a single manifest file that
00:54contained all of the data needed for playback of each of the streams and this was a lot of data.
00:59Now with new Set Level Manifest support, you can separate that stream manifest
01:03data from the playlist itself.
01:05Set Level Manifest contains only the URLs that point to the manifest for each video stream.
01:11This way the Set Level Manifest can be hosted in one place and the
01:14individual stream manifest can be hosted somewhere else, such as a CDN or
01:18other remote server.
01:20So let's go ahead and create a Set Level Manifest using the tool that Adobe has provided.
01:24We'll find it in the Flash Media Server folder.
01:27Adobe>Flash Media Server, inside of tools, and it's in the folder called
01:33f4mconfig and then inside of that is configurator, and we want to open up the
01:39HTML document, and we'll just double- click on it and it'll open in our browser.
01:43Using this tool, you can add streams to a multi-bitrate playlist and then save
01:47it out in the proper format for HDS streaming.
01:50You can then play that file in an OSMF based videoPlayer and you'll have a
01:54video that uses dynamic streaming to deliver an optimized video bitrate over
01:59standard HTTP connections.
02:01You can also choose the m3u8 tab to configure multi-bitrate playlists for
02:06streaming to Apple iOS devices.
02:08Let's see how this tool works for f4m.
02:11First, we will enter our stream names one at a time into the Stream URI field
02:15along with their bitrate.
02:19So our streams will be stored on local host of course, and they're actually
02:23going to be in the webroot vod folder, but because they're being packaged in
02:27real-time for HDS delivery, we refer to the hds-vod folder, and then the file
02:34name, explore02_, and our first bitrate is 500kbps.f4v, and then we tag on f4m
02:45at the end, so that it grabs the manifest for that file.
02:49I am going to copy that, because I want to repeat it three times, and the
02:53bitrate is 500, so we can add that one to our playlist.
02:57Okay, now we'll change the bitrate for this file to 1000, add that to the
03:03playlist, and our final stream will be 1500, and add that one to the playlist.
03:12Okay, we can now save this manifest, and we'll call it explore-hds.f4m, and I
03:23am saving it here in my Exercise Files folder along with our videos, and I've
03:27included a final version of this manifest file, so that you can compare it with yours.
03:33So we'll go ahead and Save that there and now we are done with this tool,
03:36so we'll close this.
03:37And we go to our Exercise Files, and inside this lesson, here we have are f4m
03:44
03:45file and our three videos.
03:47So we'll select them all, all four items, Copy them.
03:51These are all going to the same place, the vod folder.
03:55So let's navigate there inside of Flash Media Server>webroot>vod, and we can
04:01Paste them here and confirm.
04:05We are now ready to play this HDS file in our sample videoPlayer.
04:11So let's navigate to that inside of Flash Media Server>samples>videoPlayer and
04:22we just want to point to that new file that we just created on
04:27localhost/hds-vod/explore-hds.f4m, and that completes our address.
04:39Then go over here, click Play Stream, and this should play perfectly.
04:44(Tom Mueller: Welcome to this week's episode of Explore California. I'm your host,)
04:49 (Tom Mueller, and this week--)
04:51So our player is detecting my bandwidth and choosing the right bitrate stream
04:55for my connection speed, which is pretty fast, since everything is running
04:58locally here and it converts that on-the- fly into an HDS stream, and then starts
05:03sending me the fragments and playing the video.
05:06So you are now familiar with the process of setting up multi-bitrate streams for
05:09delivery of on-demand over HDS.
Collapse this transcript
8. Streaming Live Video with HDS
Setting up Flash Media Live Encoder for HDS broadcast
00:00Now that we've gotten a look at the simple steps involved in delivering
00:03on-demand video over HDS, we'll move on to Live Streaming, and you'll be happy
00:07and maybe even a little surprised to hear that the workflow is even easier.
00:12Let's go ahead and Stream Live from Flash Media Live Encoder to a client SWF over HDS.
00:17In previous releases of FMS, Live HDS Streaming was handled on-the-fly as it is
00:23today, but with FMS 4.5 that same stream can now automatically be packaged for
00:29delivery to Flash in HDS and iOS in HTTP Live Streaming.
00:34Like in our Live RTMP exercise, we'll be using Flash Media Live Encoder or FMLE.
00:40Now before we open up FMLE, we'll need to make one change to its
00:44configuration file.
00:45Now this configuration folder is inside of Program Files, so we'll need to open
00:50up our Text Editor or in my case Dreamweaver as administrator to be able to edit it.
00:55We'll confirm.
00:57Now we'll open up this configuration file and it can be found inside of Program
01:03Files (x86) and it's in here instead of Program Files where FMS is, because
01:10Flash Media Live Encoder is a 32-bit program.
01:12So down inside of that folder inside of Adobe>Flash Media Live Encoder>Conf, and
01:19inside of that and we find our config file.
01:21We'll open that up, and if we scroll down to streamsynchronization, we'll see
01:28that right now it's set to false, and yours probably is as well.
01:32This is the default.
01:33We'll set it to true.
01:35Now this sets the encoder to use absolute time, which is required for proper
01:38stream synchronization when we're delivering media file fragments over HTTP.
01:43Now I did talk to an Adobe engineer about this, and he said there was no reason
01:47that he was aware of to turn synchronization off for RTMP Streaming.
01:52This makes me think that it should just always be set to true.
01:55So they may make that change in the future, but it's always good to double check.
01:59So now that we have it set to true, we can Save and we can close out of
02:04Dreamweaver altogether, and open up FMLE.
02:10Let's double check some encoding settings here and make sure that our stream is
02:13compatible with HDS Streaming.
02:15In the Encoding Options panel, we want to choose the Preset High Bandwidth>800 kbps H.264.
02:23Now we'll tweak a couple of things in the H.264 settings just for
02:27better compatibility.
02:28We'll choose Baseline 3.0 and we need to have a Keyframe Frequency of 4 seconds.
02:36So we'll also need to change our Audio Format to AAC to be compatible with H.264
02:44and HDS Streaming, and if it's not available for you, as I mentioned before,
02:48you'll have to purchase the main concept add-in.
02:51So now we're ready to connect to FMS, even though our published stream will be
02:56received over HTTP, this original Live Encoded Stream is sent to FMS over RTMP.
03:02So we'll start out with RTMP, and of course, we are sending it to localhost
03:06and instead of Live, as we did with RTMP delivery, we will send it to the Live Packager Service.
03:12The Live Packager Service is the FMS Service that performs as its name
03:16indicates, Live Stream Packaging.
03:18It will receive or ingest the Live Stream from FMLE, package it into f4f
03:23fragments and create an f4m manifest on the fly.
03:27And finally, we'll enter the name of our Live Stream, and we will call it
03:31exactly that Live Stream, but we also have to pass in some additional
03:35information about the event that we want to associate this Live Stream with.
03:39I am going to use the default event that ships with the Live Packager called Live Event.
03:44An event consists of a directory inside of the Live Packager application folder on FMS.
03:50Inside are two XML files where you configure information about the event.
03:54In most cases you can just use this default event like we are doing here.
03:57So we are now ready to start encoding the stream, and we do that by clicking
04:02Start, and we are now successfully encoding video and audio, and we are
04:08sending this Live Stream to the Live Packager Service on FMS where it's being
04:12processed for HTTP delivery.
04:14In the next lesson we'll view that stream in a videoPlayer in our browser.
Collapse this transcript
Testing a live HDS stream in a sample player
00:00Now that we have a Live Stream Broadcasting to the Live Packager Service on
00:04FMS, we can view that stream in Flash Player in a browser, and we'll do this
00:09exactly the same way that we've been testing our other streams in the sample videoPlayer.
00:13I'll open it up in a browser and scroll down to enter our Stream URL.
00:26I am going to enter the URL of our manifest file, and this file is created for
00:30us by the Live Packager Service.
00:31It's on localhost of course, hds-live.
00:36
00:45So it's hds-live/livepkgr/_definst, and this is the default instance of our Live
00:51Packager, and we want to specify our liveevent, ends our event and then finally
00:57our stream name, livestream.f4m
01:04We can specify that it's Live by checking that box, and then click Play Stream.
01:09A few second delay as the Live Stream needs to be packaged.
01:14And we can specify that it's live by checking that box and then click Play Stream.
01:21So there was a few seconds delay.
01:22There is the Live Stream needed to be packaged before it's delivered to our
01:25player over HTTP and that was Live Streaming.
01:29The exciting part is that the same stream can be viewed on Android and
01:33repackaged for delivery to iPad, iPod and iTouch with only a few minor tweaks.
01:38So you've now successfully broadcasted a Live Stream over HTTP to Flash Player.
01:43This will allow you to stream to Android Powered devices, Flash Player and AIR
01:48over standard HTTP connections.
01:50Now you're ready to explore in my opinion the really fun part of FMS,
01:55real-time communication.
Collapse this transcript
9. Understanding Custom Server-Side Applications
Introducing server-side applications
00:00So far in this course we've talked a lot about streaming video with Flash Media
00:04Server, but let's not forget that FMS has many other powerful uses beyond simple
00:09streaming, such as real-time communication for video and voice conferencing,
00:13sharing data and multiplayer gaming, just to name a few and server-side code
00:17lets you get the most of those features.
00:19Server-side code can be a confusing concept at first.
00:22So let's take a look at how it differs from the client-side ActionScript
00:26that you are used to.
00:27Then talk about some common things you might do on the server-side that
00:30you can't or wouldn't want to do on the client.
00:32So the bulk of what's possible in a Flash application is done in standard
00:37client-side ActionScript.
00:39This includes a variety of tasks such as requesting and displaying external
00:43data, calculating and storing game scores, game logic, video playback logic, and so on.
00:50Today most of this code is written in ActionScript 3.
00:53Then there is server-side ActionScript, and server-side ActionScript functions
00:57are more limited than client-side, but can end up being more secure and
01:02efficient for some tasks, and you can do things on the server that wouldn't be
01:06possible in client-side code, like advanced authentication, creating detailed
01:10activity logs and linking application instances together on the server for
01:14chat-room lobbies, and so on.
01:16Server-side ActionScript is very similar to JavaScript 1.5, so if you're
01:21familiar with JavaScript, you've got a headstart, and it's almost ActionScript
01:251.0, but with limited classes and the addition of some FMS specific classes.
01:30It's also case-sensitive, where true as1 is not.
01:34Server-side ActionScript files have the .asc extension and that stands for
01:39ActionScript Communication file, and they can be edited in the Flash Actions
01:43panel or in any text editor.
01:46The ASC files are stored inside of the Application folder on FMS, and we'll get
01:50a good look at exactly where, in our upcoming exercise.
01:54Instead of executing code in the Flash Player in a browser, server-side
01:58ActionSript runs on Flash Media Server itself.
02:01It's also important to note that custom server-side ActionScript can't be used
02:04on Flash Media Streaming Server.
02:07You can only execute custom server-side code on Flash Media Development Server,
02:11the Interactive Server or the Enterprise Server.
02:14As I mentioned, you might consider using server-side code to improve efficiency
02:18of your application.
02:19Say you have to feed weather information to all connected clients.
02:22Rather than have each client call out to the weather server individually, you
02:26could make a single call on the server- side and then pass all that weather data
02:30back out to all connected clients.
02:32This is much more efficient than making multiple individual calls to a service,
02:37especially if the service is slow or isn't ready to handle a lot of simultaneous
02:40connections, your apps' performance will suffer.
02:43Another good use of server-side logic that comes to mind would be for storing
02:47high scores or even scores of all connected players in a multiplayer game.
02:52Calculating and storing this information on the server-side would be more secure
02:55than doing it on the client-side, as the data could potentially be manipulated.
02:59So now that you have a high level view of what server-side ActionScript is and
03:04how it differs from client-side code, let's look at some of the classes
03:07available, focusing on those that will get you up and running with your own
03:10custom applications in FMS.
Collapse this transcript
What can you do with server-side code?
00:00I mentioned in the previous lesson that Server-Side ActionScript is like
00:03JavaScript, and similar to ActionScript 1.0.
00:07It of course doesn't have the full functionality of either.
00:10To help you wrap your head around the kinds of things you can do in
00:12server-side code, I think it's helpful to look at the basic FMS specific
00:16classes that are available.
00:18Since this course is aimed to get you up and running quickly, this complete
00:21list gives you a quick overview of what's available and you can see that there are many.
00:25But I will focus on a couple of them here that you would be most likely to use,
00:29Application and Client.
00:31We'll be working with these two classes in this chapter's exercise.
00:35Many of these other classes give you control over data sharing and storage,
00:39including ByteArrays, SharedObjects, peer-to-peer communication, SOAPcalls, and
00:45XML Sockets and Streams.
00:47Then you have stream controls available with NetStream, ProxyStream, and Stream.
00:52You can even use NetConnection to chain servers together for scalability and
00:56enhanced communication.
00:57If you plan to build a complex application on FMS, these classes will be your friends.
01:02I suggest diving into the Flash Media Server Developer's Guide and the
01:06Server-Side ActionScript reference to get a deeper understanding of
01:09Server-Side ActionScript.
01:11So let's now take a closer look at the Application and Client classes, two
01:15classes that are the foundation of any server-side application on FMS.
01:19Starting with the Application class, each FMS application has a single
01:24application object which lasts until the application instance is unloaded from the server.
01:29With this class, you can accept or reject connection attempts, or even create
01:34functions that are triggered when an application starts or stops.
01:37The most important elements of the Application class are the event handlers.
01:41They help create the structure and flow of the server-side application.
01:45You can use these events to trigger functions such as playing server-side
01:49streams, writing data to a file, tracing debug info, and so on.
01:54Next is the Client class.
01:56The Client class gives you a way to handle each user or client that connects to
02:00a specific FMS application instance.
02:03When the client connects to the application, FMS automatically creates a client
02:07object and destroys it when they leave.
02:09You can use the Client class to do things like set read-write permissions;
02:14set bandwidth limits, and get information about the client, such as their IP
02:18address and referring URL.
02:20You can even use the Client class to trigger client-side functions remotely,
02:24connecting the client-side and server-side application logic together.
02:27So as you can see, server-side code can be very useful helping your
02:31applications accomplish things that wouldn't otherwise be possible or wouldn't perform as well.
02:36In the next chapter, we'll create a simple custom server-side application, so
02:39you can see the structure firsthand.
02:41First though, I'm going to introduce you to the Flash Media Server
02:44Administration Console, an invaluable tool for FMS application development.
Collapse this transcript
Using the Administration Console
00:00Since we can have both client-side and server-side code in a Flash Media Server
00:04application and RTMP connections and streams can be finicky, having a tool that
00:09gives you insight into what's happening on the server is invaluable.
00:13The tool that ships with FMS for this purpose is the Flash Media Server
00:17Administration Console or the Admin Console as what we'll refer to it from now on.
00:22The Admin Console is a SWF file that runs in Flash Player.
00:25It allows you to maintain the server, monitor applications, manage users,
00:30and debug applications.
00:31There are a couple of ways to quickly access the Admin Console.
00:34The first would be to go to the Start menu, navigate to your FMS install
00:39directory, then Adobe>Flash Media Server 4 .5, and then here's a direct link to it.
00:47Or we can open it up directly in the browser.
00:49We'll open our browser here and go to our homepage for FMS which is located at localhost.
00:58This is our Start Screen, scroll down and pause that video, and then we can link
01:05directly to the Admin Console here.
01:06We'll just click on this and it'll open in a new window.
01:09In the server address box we'll type localhost and I have it here stored.
01:13And then we put in that username and password that you created when you installed FMS.
01:19So I named my username is admin, enter my Password.
01:25Now if you are running across the network or on a hosted version of FMS,
01:29you'll want to type the server's name, or IP address in the server address bar
01:33instead of localhost.
01:34So then we'll log in and after successfully connecting, you'll see a list of
01:39currently running application instances.
01:42Right now, you can see that the vod application is running.
01:45This is because we opened up the FMS start page and it started to play
01:48an on-demand video.
01:49So let's look at what kind of information we have here so you're familiar
01:52with the interface.
01:53As a developer, you'll be using this View Applications tab a lot.
01:57From here you can see the live log and this is where any server-side trace
02:01messages will appear as you'll see in our sample app in the next chapter.
02:05You can also see what Clients are connected, Shared Objects and their values.
02:10Now Shared Objects are used to share data in real-time
02:13communication applications.
02:15You can see what streams are currently running and you can access real-time
02:20performance data here in this running graph.
02:23It tells you things like how many clients are connected and for how long, their
02:27bandwidth consumption and overall CPU and memory usage being consumed by FMS.
02:32So as you can see, the Admin Console can give you valuable insight into what's
02:36happening under the covers in FMS.
02:39We'll use it in the next chapter when we dive into writing our own custom video
02:42broadcasting application.
Collapse this transcript
10. Building a Video Broadcast Application
Writing the server-side application
00:00I've been looking forward to this chapter to introduce you to my favorite
00:03feature in FMS, real-time communication.
00:06The idea that you could share video, audio, and data between connected
00:10SWF clients across the globe in real -time right in the Flash Player has
00:13always intrigued me.
00:15Back when I got started, FMS was called Flash Communication Server.
00:19And while the basic server-side aspects haven't changed much since then, there's
00:23still no technology or platform today that makes this kind of real-time
00:27communication so accessible.
00:29In this chapter, we'll create a custom Flash Application that broadcasts your
00:33webcam from one client to another.
00:35We'll create a custom server-side application on FMS, and then I'll walk you
00:40through the client-side code you'll use to capture and broadcast your webcam
00:44live, using RTMP Streaming.
00:46So let's dive into a sample broadcasting applications and see how easy it is to get started.
00:51So the first thing we need to do when creating a new custom application in FMS,
00:56is to add a folder for it in our Applications directory.
01:00So here I am inside of Program Files, Flash Media Server, and here's our
01:04application folder, I'll open that up, and simply right-click, choose New,
01:10create a new folder, and we'll give it the name of our application, which is lyndacast.
01:15Now our Server-Side ActionScript file will go inside of this folder.
01:19And I do recommend keeping your app name simple and all lowercase.
01:24Next, we want to create this ASC file.
01:27Since we'll be creating our client-side application in Flash Professional, I'll
01:31open that up and create a new ASC file.
01:34You could of course write this simple file in a text editor if you prefer.
01:38So let's go ahead and open up Flash Professional and the quickest way to get
01:42that is to go to our Search bar down here and to start typing Flash, here it is.
01:47I recommend that you run Flash as Administrator, and this way you can save files
01:51directly into your applications folder.
01:54Because it's inside of Program Files, Windows 7 really gets kind of upset with
01:58you when you try to alter things in there.
02:00So running as Administrator can help alleviate some of those roadblocks.
02:06So I have provided the ASC file for you all finished and ready to go, and we're
02:11going to take a look at that.
02:12But when you're ready to create your own ASC files, I wanted to show you quickly
02:16how you can do that here in Flash. Choose File>New.
02:21Normally when you're creating a new FLA, you just choose ActionScript 3.0.
02:25But in this case, we just need a communications file, which is very simple.
02:29It doesn't a timeline or anything.
02:30It's just an interface where you can type in code.
02:33So we'll choose ActionScript Communication File and say OK and you can see, you
02:38can just type code here and save the file.
02:40But I do have one written for you in the Exercise Files.
02:44So let's open that up.
02:46So we'll navigate to our Exercise Files> Chapter 10, and here is our main.asc file.
02:53You can see it is a Flash ASC File, so I'll open that up and this is
02:57Server-Side ActionScript.
02:59Now all server-side applications are named main.asc.
03:03Or if that gets too confusing for you to manage, if you've got multiple apps
03:06that you're working with at once, you can give it the name of the application.
03:10In our case, that would be lyndacast.asc
03:13But for now we'll just keep it at main.asc
03:15So the first thing you want to do in Server-Side ActionScript is to create the
03:19structure of the application.
03:21And as I mentioned earlier, the structure of the server-side application is
03:24based on event listeners.
03:26And here we set up a very basic structure that listens for onAppStart,
03:30onConnect, and onDisconnect.
03:35Then inside each of those listeners we'll add some traces that give us some
03:39feedback about what's happening as the clients connect and disconnect.
03:43So when the application starts, we'll use the trace command to print out a
03:46message in the admin console that lets us know a new instance of the
03:50application has been created.
03:52Now remember, when you put in traces in Server-Side ActionScript, that doesn't
03:55appear when you launch the SWF.
03:57You don't see those traces anywhere.
03:59The only place that you'll see them is in the admin console.
04:02And then when clients connect, we read in the client name that they pass in, and
04:07then print that out to the console.
04:09We'll also want to go ahead and accept that client connection, or they won't
04:12actually be allowed in.
04:14Finally, we'll print a message that they've been accepted.
04:17And then when a client disconnects from the application, we'll print that message out.
04:21Okay, so now we want to actually save this main.asc in our application folder.
04:27So we should be able to, since we're running as Administrator, Save As and then
04:32navigate to our applications folder.
04:35And I do recommend if you're working with FMS a lot that you put a shortcut
04:39to that folder here.
04:40I just didn't want to confuse you by doing that.
04:44So we'll navigate to Adobe>Flash Media Server 4.5>applications>lyndacast.
04:51Then we can save that file and we have now created a custom
04:57server-side application.
04:58Next, we'll open up the broadcaster and the viewer client applications in Flash
05:04Professional and I'll walk you through their code, so you can see how the
05:07client-side interacts with the server-side code.
Collapse this transcript
Broadcasting a live webcam stream
00:00In the interest of getting you started quickly with custom FMS applications,
00:04I've provided two Flash source files in the Exercise Files included with this course.
00:09These source files have all of the code in place for sending and receiving a
00:13Live Stream in Flash Player using Flash Media Server.
00:16In this lesson I'll walk you through the application that sends the Live Stream
00:20called lyndacast_broadcast.fla.
00:23If you are a lynda.com member you'll find this file in the Exercise Files
00:27included with the course.
00:28If not you can follow along with the video and re-create the file as I explain
00:32the code and the various elements.
00:34So we'll start by opening up our lyndacast_broadcast in the Exercise Files and
00:41we want the Flash document.
00:42So we'll double-click that, it opens in Flash.
00:46Now here I've created an interface that includes a couple of crucial elements.
00:51A dynamic text field and we'll use this to get some feedback about our RTMP
00:56connection as we try to connect to FMS.
00:59And I've given it an instance name of statusText so we can address it in ActionScript.
01:05And the other element is a generic video object and this is where you'll be able
01:09to see yourself as you broadcast your webcam.
01:11I have it here inside of a symbol because I wanted to add a gray background and
01:16this is really just an aesthetic choice, it provides a placeholder while Flash
01:19is connecting to your web cam.
01:21So if you drill down in here, you'll see here is our video object and I've given
01:26that an instance name myVid and below that is our box.
01:30So going back up to our main level, another thing that I did do with the video
01:37object is I flipped it so it was a mirror image.
01:39Now it's pretty easy to do.
01:41You just select it and choose Modify>Transform>Flip Horizontal.
01:45So I've given this symbol the name videoOut so we can address it in ActionScript.
01:51And now moving onto the ActionScript code you can see on the timeline that I've
01:56created a separate layer called actions, and that's where all of our actions are.
02:00Having that selected I can choose the Actions shortcut here.
02:04You can also go to Window>Actions and it will pop-out and when we open up this
02:09Actions panel we can see the code that connects to FMS, captures the local web
02:13cam and stream it to our custom lyndacast application.
02:17Let's walk through it so you understand how all of this is done.
02:20With FMS all tasks need to be executed in a specific sequence.
02:25For example, it's important that the net connection between the Flash client and
02:29FMS be established before trying to send any data or streams.
02:33So the first thing we do is establish that net connection.
02:37Now in this case we could connect to local host because we are running this on
02:41the same machine that is running FMS, or if you want to connect over the network
02:46we can supply the IP address.
02:48If you're using a hosting service such as Amazon, or Influxis they'll provide
02:53you with the correct connection address.
02:55In addition to the FMS address, we are adding another piece of optional data, the
03:01name of the client, in this case the broadcaster.
03:05You can pass in any information here that you like and it'll be available
03:08in server-side code.
03:10So next we need to add some functions that handle data and errors that may
03:14get sent back to us when streaming video. Then we want to listen for net status events.
03:20These are events that provide information about both the net connection to FMS
03:25and the net streams that we play.
03:27We can listen for specific codes and react accordingly.
03:31In this case we listen for a success or a fail message.
03:35If it fails we just trace out the message into the status text field and if
03:39it's successful we trigger the setupBroadcast function which will start our broadcast.
03:44Skipping down to the setupBroadcast function you can see that this is where the
03:48real action is happening.
03:50First, we are instantiating a camera object and connecting it to the outgoing
03:54net stream then we do the same thing with the microphone and finally we attach
04:00the local cam to the generic video object called videoOut.myVid, and then we
04:06publish the stream on the outgoing net stream.
04:08We give it a stream name of broadcast and specify that it's live and that is it.
04:14When this application runs it will connect to FMS and send our web cam stream to
04:19the lyndacast application and we will test this in a few minutes but first we
04:23need to create the viewer application which will allow clients to connect to
04:28lyndacast and view our broadcast stream.
04:30In the next lesson we'll look at lyndacast_view and see how that's done.
Collapse this transcript
Viewing the live webcam stream
00:01Now that we've created a custom FMS server-side application and captured and
00:05broadcast our web cam the last step is to view that web cam stream in a Flash client.
00:10I've created this client application for you and in this lesson we'll go
00:13through it and look at the elements and the code needed to connect to FMS and view that stream.
00:19So we'll go into our Exercise Files and open up the Flash document and here it is.
00:26Now the code for viewing a stream is almost identical to that of broadcasting.
00:30We still need to connect to the same instance of our lyndacast application and
00:34once connected request the stream that we called broadcast.
00:37Now the elements on the stage in the Viewer application here are about the same
00:41as those in the broadcast app except I did switch sides.
00:44So it's a little easier to tell that one is the Viewer and one is the Broadcaster.
00:47Here is our dynamic text field.
00:49It still will trace out our status message and here the video object is
00:54slightly different.
00:55I've called it videoIn instead of videoOut just for clarity and if we drill down
00:59into it, you can see that I add in an image on a layer below the video object.
01:05This is totally optional but a nice trick to show alternative content if a Live
01:10Stream isn't being broadcast.
01:12If there is a Live Stream it will fill in the video object and cover up this image.
01:17This kind of a hack but it works nicely.
01:19I've also added another little optional feature that plays an alternate video
01:23when the broadcast ends and you'll see how that's done in a moment.
01:27So that's it for the elements here on the stage.
01:30Let's go ahead and dive into the ActionScript and see how the video stream is requested.
01:34So we'll go back up to our top layer, choose our actions layer and open up the Actions panel.
01:41So as I said most of this code is the same as in the broadcast applications.
01:46The only difference in the NetConnection is that we've changed our client name
01:50to the Viewer from the Broadcaster.
01:52The error handlers are all the same and the NetStatus handler is the same.
01:58We are just calling our NetStream in_ns instead of out_ns.
02:02Again, this is just for clarity.
02:03So we know we are bringing data in on the NetStream here in the Viewer and
02:07pushing it out in the Broadcaster.
02:12And down here we are adding an additional custom function that listens for the
02:16stream status event NetStream_Play_Unpublish_Notify
02:20This notice will be sent to us if we are watching a stream and the publisher
02:23stops sending video and when that happens we are telling Flash to start playing
02:28a file called offline.f4v
02:29I'll show you where that file goes in a moment.
02:32The additional numbers that are being passed in tell FMS what type of stream we
02:37are requesting and how long we'd like it to play.
02:40The 0 tells FMS that it is a prerecorded video and -1 tells it to play the
02:45entire duration of the file.
02:47You can refer to the FMS documentation to find out all the other different codes you can use.
02:52And that's all we need to play the stream with a couple of extra features.
02:56When we compile this SWF and test it we'll connect to FMS and play the Live
03:01Stream from the lyndacast application.
03:03There is one more detail we need to handle before testing placing that
03:06offline.f4v video file in the right place on FMS so it will be available to
03:11stream when our Live Stream stops broadcasting.
03:14So this video needs to go into a very specific place for it to be available to
03:18the lyndacast application.
03:19So let's close Flash for a moment and go over to our applications folder in FMS.
03:26So we'll go down into lyndacast and here we need to create a new folder called streams.
03:36Then inside of that we need to create an additional folder for the instance
03:41of the application.
03:42Now we didn't specify an instance name with our connection string when we
03:46connected to lynda cast.
03:48So in that case definst is always used and we'll create a folder with that name.
03:53It's _definst_ that's the default instance.
04:01Now instances of applications can be kind of handy especially if you have a
04:05chat room or an application like that where you want to have distinct private
04:09versions of that application like a chat room where members who join that
04:13specific instance can speak with each other but data is not shared from
04:18instance to instance.
04:20So inside of definst we can place our video and I've provided this
04:25offline.f4v here for you.
04:27So you can Copy that, Paste it here inside of definst folder in lyndacast and
04:36yes I do want to copy it here.
04:39So with that video file in place we are now ready to test our Live Video
04:43Broadcast application in the next lesson.
Collapse this transcript
Testing the video broadcast application
00:00Now that we have the elements of our Live Video Broadcast application in place,
00:04we are ready to test our custom application.
00:07We'll compile both the lyndacast_ broadcast.swf and the lyndacast_view.swf and
00:12watch the Live Stream play locally.
00:14When the broadcaster stops sending the stream, the default offline video will play.
00:18So let's start out with the View application.
00:21So we'll open up lyndacast_ view.fla in Flash Professional.
00:24Now, I have provided both the View, and the Broadcast files in this
00:30lesson's Exercise Files.
00:32So now to compile this, we'll go up to Control>Test Movie>Test, and this
00:41will create the SWF file, and test the application here in the stand-alone Flash Player.
00:46I am getting a NetConnection.Connect. Success message, and hopefully you do too.
00:51If you get a NetConnection.Connect. Failed message instead, double check that
00:56your NetConnection URL is correct.
00:58In this example I am running everything on the same computer as FMS.
01:02So my URL is an IP address.
01:04It could also be localhost.
01:06Yours may need to be an IP address or the address given to you by your
01:10FMS hosting provider.
01:11Now, as expected, we see the default offline image here since the broadcaster
01:16isn't yet broadcasting.
01:17So we'll leave this viewer open, so that you can see how it switches it right
01:21over to the Live Stream automatically when the broadcaster starts streaming.
01:25So we'll slide it over here to the side and now we'll go ahead and open up
01:30lyndacast_broadcast in Flash and we'll compile and run this SWF by going to
01:40Control>Test Movie>Test.
01:46For the net status code Net.Connection. Connect.Success is received, and we are
01:50immediately prompted to allow Flash to access our web cam and microphone.
01:56I will say allow and now you see my web cam is captured here, and we are now
02:02broadcasting a stream to the lyndacast application on FMS.
02:07If we switch over to the Viewer, we can see our Live Stream playing here.
02:10So we know that we are now broadcasting live from one Flash client to another
02:15Flash client, and you'll see there's a very slight delay here, and that's to be
02:19expected with Live Streaming.
02:22So let's test one last feature of this application.
02:25When I stop broadcasting by closing lyndacast_broadcast app, the unpublished
02:31notify message is sent to the client, starts to play the offline F4V file.
02:36Now, these SWFs would normally be running on two different computers, and all of
02:41this is running locally here.
02:43So if you're running FMS on a publicly accessible web server, anyone in the
02:47world could broadcast and view your streams. Pretty cool.
02:51So walking through the structure and code of this Live Broadcast application
02:54should have gotten you familiar with how custom apps are built on FMS.
02:59I hope you use this basic example to build upon and really dive into FMS
03:03application development.
Collapse this transcript
11. Streaming On Demand with HLS and RTMP
Understanding on-demand streaming
00:01Now we will really dive into one of the most exciting parts of FMS4.5 and
00:05possibly the reason you're looking to get started with it;
00:07Streaming To Devices.
00:09Delivering video to devices using Flash Media Server is actually surprisingly
00:13easy, because the packaging process is handled for you.
00:16You don't need to encode into multiple formats.
00:19But trying to figure out the correct URLs and folders for your on-demand video
00:22files can be confusing.
00:24In this chapter, I'll walk you through the process of setting this up and
00:28testing, and give you some tips on formatting your source video.
00:32Then we'll move on to Live Streaming to devices, and wrap up by building a Video
00:36Player that will deliver the right video stream to the right device.
00:39Let's begin with a quick overview of the technology behind video playback on devices.
00:45Adobe recommends using HTTP streaming technology for streaming to devices.
00:50Earlier in this course, I covered HTTP streaming in more depth, but here's a quick review.
00:56In HTTP streaming, the video content is broken into small fragments, which can
01:01be delivered quickly even on low bandwidth connections, and then, I reassembled
01:06instantaneously for smooth playback.
01:08Both Flash, and iOS use a form of HTTP streaming, but of course, the formats are
01:13slightly different, making them incompatible.
01:15As you will see though, this isn't as much of a problem as it used to be now
01:19that we have on-demand packaging.
01:21Now, let's look at the way on-demand packaging works for prerecorded video files.
01:26First, you place your video file into the webroot/vod folder inside of the Flash
01:33Media Server folder.
01:34This source video must be H.264 video with AAC audio, saved as an F4V.
01:40I will give you a few more encoding suggestions for this file in a moment.
01:44Then when you want to play that video on iOS, you would request it using
01:48a special URL path.
01:50It looks like this
01:52This initiates the packaging process and FMS automatically converts your source
01:57F4V into an M3U8 stream for HTTP Live Streaming delivery.
02:03Referred to as HLS, this is the format supported on iOS.
02:08When you want to play that same video in Flash Player on a computer or on an
02:12Android device, you would use a slightly different URL.
02:15It looks like this.
02:17This prompts FMS to package the source F4V for HTTP Dynamic Streaming or HDS
02:24which is playable in flash.
02:25Devices running Android 2.1 or later support Flash Player.
02:30Now technically, Android devices also support Apple's HLS format, but as of
02:35today, that support tends to be buggy with inconsistencies in HTML5, and native support.
02:40In future Android updates, they'll likely have this sorted out, but for now, I
02:44recommend using Flash Player and HDS for Streaming on Android.
02:48Now, packaging does what its name implies.
02:50It simply repackages the existing video and audio bits into a different box so to speak.
02:55It doesn't transcode or change the actual video data.
02:59So you need to have a source video that's encoded with settings that are
03:02playable on your target device.
03:04Mobile devices have lower processing power than desktop computers, and often
03:08connect to the Internet over slow wireless networks.
03:11Because of this, it can be difficult to get high quality video to play smoothly,
03:15as I'm sure you've experienced firsthand.
03:18I've provided you with source videos with the Exercise Files for this course
03:22that are optimized for the devices I will be demonstrating.
03:25When you're ready to encode your own videos, there are some general
03:27guidelines you should follow.
03:29These are outlined clearly in Adobe's Simple Mobile Video Encoding
03:32Recommendations, or more advanced encoders will find the Video Encoding Cookbook
03:38and its Mobile Addendum very helpful.
03:41Here are the recommended settings for your videos for delivery over 3G networks.
03:47You want to use the H.264 codec for video, and target Level 3.1, or you can use
03:543.0 if you want to target older iOS devices.
03:58Use the Baseline Profile and the recommended bit rate is 800kb per second for
04:04video and up to 64kb per second for audio.
04:07Then the actual Dimensions of the video should be 640x480, or for
04:13widescreen, 640x360.
04:17Now that you have the lay of the land, let's dive right into trying out the
04:21on-demand packaging features of FMS.
04:23We will view a sample video on an iPad and on an Android device.
Collapse this transcript
Testing an on-demand HLS stream on iOS
00:01Now that you're familiar with the on- demand packaging feature of FMS, we are
00:04ready to take it for a test drive.
00:06We will copy a sample video file to the correct location on the server and then
00:10view that HLS video stream on an iPad.
00:12So the first thing we need to do is grab our sample video file and we can find
00:17it in our Exercise Files for this lesson, and here it is, explore.f4v
00:23So I will right-click on that, copy it, and then navigate to my webroot/vod
00:30folder inside of FMS.
00:34That is in my Program Files> Adobe>Flash Media Server, webroot.
00:41And once here, I can right-click and paste. Now webroot is the Apache web server
00:46folder, so anything in here is going to be accessible over HTTP on our network.
00:51The Just-in-time Packager is going to look here in the vod folder for the
00:55content, and then it will package it appropriately for our device.
00:58So let's put that to the test.
01:00I will switch over now to my iPad.
01:02So to play this video in the native player here on iOS, we will use Safari, and
01:08we just need to request the following URL;
01:12http:// and then the IP address where our FMS server is running, and in our case
01:19here, it's 10.1.111.126.
01:29(Yours will of course be different)-
01:30/hls-vod/explore.f4v.m3u8.
01:48Notice that I've just added the extension m3u8 to my f4v file name.
01:53This is requesting just-in-time packaging for this f4v file, so I can play
01:58it here on my iPad, and FMS performs this just-in-time packaging for us automatically.
02:04Here is my video playing on the iPad without any additional workflow, or setup on our part.
02:09We just uploaded our F4v file to the right place in the Apache webroot folder on
02:14FMS, and we are streaming.
02:17Now, for your reference, here are the Encoding Settings used for the Explore video.
02:21H.264 video codec, using Main profile and a Level of 3.0, and that's for the
02:28best compatibility, AAC audio codec, a Bitrate of 1Mb per second.
02:34Now, Adobe does recommend 800, so I did step that up slightly for quality, and a
02:40frame rate of 24 frames per second.
02:42I used a Keyframe interval of 4 seconds or 96 frames in between each keyframe,
02:48and saved it as an F4V file.
02:50Now, this same file will also play in Flash as we'll see in a moment.
02:54Remember, when you use your own video files here, they need to be encoded
02:58with settings that are supported in both Flash and the iOS devices you wish to target.
03:03For information about those settings, you can refer back to the first lesson in this chapter.
03:07So you have now successfully streamed to iOS using the new HLS streaming feature
03:11in Flash Media Server 4.5.
03:14Next, let's view that same video using HDS on Android.
Collapse this transcript
Testing an on-demand HDS stream on Android
00:01We just saw how simple it was to stream to an iOS device using the just-in-time
00:05packaging features of FMS 4.5.
00:08Now let's try it on the Android.
00:10I have a Nexus S phone here, but you can use any Android power device that
00:14supports Flash Player 10.1 or later.
00:16So we'll need to load our stream into a video player application running in Flash Player.
00:21Adobe provides an easy-to- configure sample player with FMS.
00:25It's in the samples folder in the Flash Media Server 4.5 folder, so let's find that now.
00:31So we'll go to Local Disk>Program Files >Adobe>Flash Media Server, and here in
00:39the samples folder, we will find videoPlayer.
00:42So we can just right-click on this and copy it, go back, and we want to paste
00:47it into webroot so that we can access it through over our local network as a Web page.
00:52So we'll need to paste that here in our webroot folder so that we can access it
00:57through a Web browser and use the video player.
01:00And later I'll show you how to create a universal video player that plays both
01:04Flash and iOS depending on the device.
01:07If you want to know more about building video players for Flash, take a look at
01:11my other lynda.com course, Publishing Video with the Flash Platform, and I get
01:14into actually building custom players in that course.
01:18So we want to test on- demand video on our Android now.
01:22So now that we have our video player here in our webroot we can go to our
01:26Android device and now we'll enter my IP address, yours will be different.
01:32http://10.1.111.126/ videoplayer/videoplayer.html.
01:32Here you'll see the Flash Media Playback configuration interface.
01:52You can configure it and test the player right here on this page.
01:56First, we'll paste in the URL of our video down here in the stream URL.
02:01Now as you can see, we're using the same video URL that we did for our iOS
02:05device but with a couple of changes.
02:07We're targeting hds-vod instead of hls-vod and we're tagging on the .f4m
02:14extension to our file name, requesting the manifest file that FMS creates for us
02:19during the just-in-time packaging process.
02:21So we're now ready to play our stream, so we'll scroll down here and touch
02:26the PLAY STREAM button.
02:29We can even go full screen and our video plays.
02:34(video playing)
02:34So you've now successfully streamed to Android using HTTP Dynamic Streaming on
02:42Flash Media Server 4.5.
02:43Next, let's broadcast a live stream across iOS and Android.
Collapse this transcript
12. Streaming Live Video to Devices with HLS
Streaming live video to devices
00:01In the past, we could only stream live video to Flash using Adobe's RTMP streaming.
00:06While, RTMP does work on devices that support Flash.
00:10Anyone on an Apple device won't be able to watch your live stream.
00:13You'd have to encode a special stream just for them using additional server
00:17and encoding software.
00:19Now Flash Media Server 4.5 solves this problem by taking a single live stream
00:23and packaging it in real- time for HLS and HDS delivery.
00:28Let's take a look at how this is done.
00:30The workflow for real-time packaging of a live stream is slightly different from on-demand.
00:34There's no file to upload as there is with on-demand.
00:37The live packager service on FMS accepts your incoming live stream and converts
00:42it to both HLS and HDS format as requested by a client.
00:47As you can imagine, this does add a few seconds of latency while the stream is
00:50being boxed up into the new format.
00:53Just like on-demand playback, you would request the live stream using a special URL path.
00:58The URL for live streams is a bit more complex than with on-demand.
01:02For iOS it would look like this, and for Flash on a computer or Android device,
01:07it would look like this.
01:09Let's pull apart this URL so you can understand what's happening in this request.
01:13Just as on-demand, requested hls- vod and hds-vod, here we're requesting
01:20hls-live and hds-live.
01:24Then we're invoking a live packager service which performs the packaging into
01:28the format we specified.
01:29Next, we'll tell FMS which live event we want to access.
01:33Events are an extra element required in live streaming over HTTP.
01:38You can set up custom events that have specific settings and
01:41associated metadata.
01:42And this information is stored in an event.xml file on FMS.
01:47In most cases, you can use the pre- built default event called liveevent and we
01:51will be using this default event in our upcoming exercise.
01:55And finally, we ask for the live video stream, and in this case, it's
01:59simply called livestream.
02:00We tag on the appropriate file extension, either m3u8 for iOS, or f4m for Flash.
02:07When this URL is requested by a client, the Live Packager is called into action.
02:12It creates a folder inside of the Live Packager application folder with the name
02:16of the stream or streams.
02:18And then inside that folder it creates the various fragments and manifest files
02:22it will need to stream the live video.
02:24Adobe has specific recommendations for encoding live video.
02:28We'll be using those settings in our exercise, but if you want to tweak your
02:31encoding for specific devices, I recommend reading the simple mobile video
02:36recommendations article that I mentioned earlier in the course, or more advanced
02:40encoders can refer to the Video Encoding Cookbook and its Mobile Addendum.
02:45You've now had a peek at what's happening behind the scenes when you package
02:48live video on FMS and have some guidance about encoding for devices.
02:52Next, let's set up our encoding software and start our broadcast.
Collapse this transcript
Setting up Flash Media Live Encoder for HLS streaming
00:01Now that we've gotten a look at the simple steps involved in delivering
00:04on-demand video to devices, we'll move on to live streaming.
00:07To capture and broadcast a stream, we'll use Flash Media Live Encoder and send
00:11our stream to Flash Media Server 4.5 where it will be packaged automatically
00:16in real time for playback on iOS and Android devices and even in Web browsers as well.
00:22Flash Media Live Encoder or FMLE is a free download from Adobe.com.
00:27And you can get it from adobe.com/go/fmle
00:33
00:34For our purposes, we can use FMLE 3.2 or later.
00:39And before we open up FMLE, we need to make one change to its
00:42configuration file.
00:43And because FMLE lives in Program Files, we can't just edit directly.
00:49We need to have the special privileges to have access to edit those files.
00:53So we're going to do this in Dreamweaver.
00:55But to actually edit the file in Program Files, we're going to have to run
01:00Dreamweaver as an Administrator.
01:05Now an alternative to this would be to actually copy our file to the Desktop,
01:10change it there, and then copy it back.
01:12But this is just another way to do it.
01:13So I will navigate to our configuration file, I like to go to File>Open, and we
01:20already have it here but as you can see, it's inside of Program Files (x86)
01:26because Flash Media Live Encoder is a 32-bit program.
01:29That's where you will find it, in the Adobe folder, Flash Media Live Encoder,
01:34and then Conf folder.
01:37And here's a file called config, we want to open that up. It's an XML file.
01:42We just want to scroll down to streamsynchronization.
01:46Now it's probably set to false for you as it is here, so we'll change it to true.
01:51And this sets the encoder to use absolute time, which is required for proper
01:55stream synchronization when delivering media file fragments over HTTP.
02:00Now I did speak with an Adobe engineer about this and he said there was
02:03no reason that he was aware of to turn this off if you're going to do RTMP streaming.
02:08This makes me think that it should be set to true by default, so they may make
02:11that change in the future versions of FMLE.
02:14But for now we just want to go in here and make sure that it is set to true.
02:17Okay, we'll go ahead and save this file and we can close out of Dreamweaver.
02:24Now we are ready to open up FMLE.
02:27I'm going to Programs>Adobe, and there it is.
02:35And sometimes if FMLE doesn't like some of the settings you have that are not
02:38compatible, you'll see this Profile Validation dialog, and it's okay, just click
02:43Ok because we're going to make some changes here.
02:45So when you open up FMLE, you may see a video here and that's because your
02:50preview is automatically set to be on.
02:52I like to keep them off because they're a little bit distracting to me.
02:54So let's go ahead and make some changes here to make sure that our video is
02:59going to be compatible with HTTP streaming and will play nicely on our iPad as
03:04well as our Android device.
03:06So in this Encoding Options panel here, we want to choose the preset High
03:11Bandwidth (800 Kilobits per second) - H.264.
03:14Now we want to tweak these settings a little bit, so right next to H.264 Format,
03:21we will click on this wrench and this opens up the Advanced Encoder Settings.
03:27Now under Profile, we want to choose Baseline and the Level we'll set to 3.0
03:32and this is going to give us the greatest compatibility across the widest range of devices.
03:36And next we need to change the Keyframe Frequency to 4 and this is what Adobe
03:42recommends for the best HTTP streaming and we can say OK.
03:47Now you'll see that our Audio Format is set to MP3 and we need that to be AAC to be compatible.
03:55So this may be a bit of a problem for you.
03:57There are two ways to get AAC to be available for you.
04:01One is to be encoding on a Mac where FMLE can grab the QuickTime version of AAC
04:08and use it here, or if you're on a PC like I am here, you're going to have to
04:12purchase the MainConcept AAC plug- in for Flash Media Live Encoder.
04:17And that's available on the MainConcept web site and it's running about $180 I believe.
04:23Okay, as long as we have the video and audio all set up, we are ready to set up our FMS URL.
04:30So even though our published stream will be received over HTTP, the original
04:35live encoded stream will be sent to FMS over RTMP.
04:38So we're going to leave that here rtmp://
04:42and then we type in our IP address, and again this will be different for me
04:47than it is for you.
04:47You'll be using your IP.
04:50Mine is 10.1.111.126 and a forward slash.
04:57And then we want to send our stream to the Live Packager, so it's livepkgr.
05:05Now the Live Packager service is the FMS service that performs, as its name
05:09indicates, live stream packaging.
05:12It will receive or ingest the live stream from FMLE, package it into fragments,
05:17and then create a manifest on the fly that's available for playback.
05:21So next we'll enter the name of the stream and we'll leave it at livestream here.
05:25But the Live Packager needs to know what event we want to associate the stream with.
05:30We're going to use the default event that ships with the Live Packager and that
05:34is called Live Event.
05:35An event consists of a directory inside of the Live Packager application folder on FMS.
05:41Inside are two XML files where you configure information about the event.
05:46In most cases you can use the default event like we're doing in this exercise.
05:49So to actually tell FMS what Live Event we want to use, after the stream name,
05:55we put a question mark and we're going to pass it in as a variable.
05:59So the variable we want to pass in is adbe-live-event=liveevent.
06:01So we want to uncheck Save to File as that can fill up your hard drive pretty quickly.
06:17It's actually saving an FLV of the stream that you're broadcasting.
06:22We don't need to do that.
06:24And the last thing we want to do is check our Bit Rate and Output Size.
06:27Right now, it's set to 650 and that's a good kilobit per second bit rate for
06:31mobile, that's acceptable.
06:33But the Output Size isn't quite right, so we're going to say 640x480, and that's
06:37going to be compatible with the most devices.
06:39Okay, and now we are ready to stream, so we'll go down to the Start button
06:44and we'll press that.
06:46As you can see, our video encoding has started and our audio encoding has started.
06:50So we're now sending a live stream to the Live Packager service on FMS where
06:55it's being processed for HTTP delivery to Flash and to iOS.
07:00Next, we'll view this live stream on an iPad and then on an Android device.
Collapse this transcript
Testing a live HLS broadcast on iOS
00:01Now that we have a live stream being encoded in a compatible format in a FMLE
00:05and being packaged Just in Time by FMS 4.5, it's ready to be played in and iOS device.
00:12So I switch over now to my iPad.
00:14To play this video in the native player here on iOS I need to request the following URL.
00:20And again, my IP address, yours may be different
00:23http://10.1.111.126/hls-live/livepkgr _definst_/liveevent/lifestream.m3u8.
00:48Notice that I've just added the extension .m3u8 to my very long f4vf file name.
00:54This is requesting Just in Time incoding for this f4v file.
00:57So I can play it here on my iPad.
01:00And here is my video playing right here on the iPad, right from FMS with our any
01:05additional configuration or encoding on our part.
01:08So it's pretty cool.
01:08So you are now successfully broadcasting a live stream over http to iOS.
01:17Let's now view that same stream on Android in Flash player.
Collapse this transcript
Testing a live HDS broadcast on Android
00:01So we now have a live stream being encoded in FMLE and being broadcast
00:05and packaged by FMS.
00:07And we've been able to view it on an iPad.
00:09Now let's view that same stream on an Android device.
00:13Just as we did with on-demand streams we'll use the sample video player that
00:17ships with FMS to play the stream.
00:19So to use this player we'll open a browser and navigate to http:// enter your IP
00:29address, ours is 10.1.111.126/ videoplayer/videoplayer.html
00:44Now that that video player loads we can scroll down and enter the following URL
00:49into the STREAM URL field.
00:50http://10.1.111.126/hds-live/_ definst_/liveevent/livestream.f4m.
01:09Now our OSMF based video player application here will read the manifest file,
01:26get all the information it needs and then start playing the live stream.
01:30It will have a few seconds delay as the live stream needs to be packaged before
01:34it's delivered to our player over http and we're accessing this over wireless as well.
01:39Here is our live stream playing on Android and the same stream can also play on
01:43desktops as long as they are running Flash Player 10...
01:47So we've we've now successfully broadcast a live stream over http to an Android device.
01:52In the next chapter I am going to show you how to make sure that anyone on
01:56virtually any device can view your content.
01:58We'll wrap up the course by developing a universal video player using
02:02Flash, JavaScript and HTML5 that will provide the right video format to the right device.
02:08Let's dive in.
Collapse this transcript
13. Delivering Video Across Platforms with JavaScript
Creating a universal player code
00:00In this lesson we'll create embed code that's versatile enough to ensure that
00:04our video plays on the widest range of devices.
00:06Using the open source SWFObject embed code along with some HTML5 we'll create a
00:12player that first tries to play the video in Flash player, then falls back to
00:16HLS delivery for iOS.
00:19And for on-demand content we can continue falling back to an Ogg version and
00:23then finally if that's not supporting either we'll try WebM.
00:27So the first thing we'll need to do is to download the SWFObject library from Google Code.
00:32And you can get at code.google.com/p/swfobject
00:36Now for your convenience I have included SWFObject in the Exercise Files for the
00:48course so you can keep right on with the lesson.
00:51But SWFOobject if you've never used it is a very handy JavaScript library that
00:55allows you to efficiently embed Flash swf files into your web page.
01:00It allows you to set a minimum required version of the Flash player and also
01:04lets you provide alternative content that the visitor will see if they don't
01:07have flash installed and we are going to use this for our video player.
01:10I highly recommend that you use with SWFObject whenever you need to embed
01:13Flash into a web page.
01:16So the first thing we need to do because SWFObject is JavaScript code we need to
01:21put that into the web root of Flash Media Server, so that code will actually
01:24execute when we load it in the web browser.
01:27So I will navigate to my web root, Program Files>Adobe>Flash Media
01:32Server>webroot and as you can see I have copied these three Exercise File
01:39folders already, so you want to do that now.
01:41We'll be working here, so I'll close out my Exercise Files and here in the
01:48webroot we can open up the Exercise Files for this particular lesson.
01:53And in here you'll see index.html
01:57We want to open this in Dreamweaver or in your favorite text editor.
02:01We are just going to make a few changes here.
02:03So we want to be in code view and we are going to use this as I said as our
02:07template to build our universal video player.
02:10So we'll go ahead and save this as uni.html
02:15Save As and as you can see here also I have a final version of this in case you
02:24made a typo, or yours doesn't work you can always refer to that as a reference.
02:29So we'll save that here.
02:30So the first thing we'll do just so we are all on the same page here is change
02:35the title of our page, so we know what it does and we'll change it to SWFObject
02:382 Flash with fallback to HTML5.
02:45The next thing we want to do is make sure that the people who visit have
02:49version 10.1 of Flash, because that's the earliest version that supports http dynamic streaming.
02:55So if the client is using an earlier version they'll be prompted to update to
02:59the latest version of the player.
03:00So the next area that we want to pay attention to is this div here, this is
03:04alternative content.
03:06So if someone doesn't have Flash installed this is what will be displayed to them.
03:11The first thing we'll do is change the title here instead of
03:12alternative content.
03:13We'll call that fallback to HTML5 or iOS devices.
03:20So this is where we will put our HTML5 video player.
03:25So we'll replace this get Flash player code here and this HTML5 video player
03:30will play our video for people who don't have Flash.
03:34So because the browser will keep trying to play video tags until it finds a
03:38format it can handle we can even add additional video tags here for other
03:42formats such as Ogg and WebM and we will do that in the next lesson as well when
03:46we set up the on-demand streams.
03:48It's important to note that right now you can't use Ogg and WebM for live
03:52streams through Flash Media Server.
03:53So let's go ahead and add HTML5 video player code.
03:57so we want our video tags we'll start at Video and we want that video player
04:02to have some controls and we'll set width to be 640 and height 360.
04:09Now that's a good size for devices.
04:20And then we close the video tag.
04:26So this will create a video player on the page in browsers that support it.
04:30We can add some code beneath this that will be shown to those who don't have
04:34Flash or don't have a modern browser that supports the video tag.
04:37So let's do that now.
04:40We do up here, Your browser does not support Flash Player 10.1 or the
04:53HTML5 video element.
04:55So now let's go ahead and save that file and we've created the basic code for
05:06our universal video player.
05:08Right now, this page will load the test swf that comes with SWFObject but
05:11won't do much else.
05:13Next we'll add links to our on-demand streams, including those exotic Ogg and WebM formats.
05:18We'll then move on to publishing a live stream using the same universal
05:22video player code.
Collapse this transcript
Publishing an on-demand stream with a universal player code
00:01Now that we have our Universal Video Player Code setup we can configure it to
00:04play a pre-recorded video.
00:06This the same video we used earlier in the course, but this time we are
00:09embedding it into a web page and providing fallback to HTML 5 Delivery and Flash
00:14isn't available on the client.
00:15So to set this up, we will just use the template that we started in the last
00:19exercise and add a few URLs to our videos.
00:22So with Uni.html open in your HTML Editor and this is also included in this
00:28lesson's exercise files.
00:29Go ahead and save this file as uni_ vod.html and that's going to be a more
00:35descriptive name and we are moving up to our folder for this lesson.
00:41And we are going to call it uni_vod.html.
00:50And we had another version in there, so I will just overwrite that.
00:53We don't want to update things in this case, but you will see how that can
00:55be handy in a moment.
00:56So we will click No.
00:57So let's add the easy links first, HTML 5 links.
01:02So scrolling down to our video tag which is here,
01:06we are going to add some things in between the opening and closing tags here.
01:08And what the browser will do, is go through each of those items until it finds
01:12something it can play and if it can't play any of them, it will show this text,
01:17provided its in between the video open and close tags.
01:19So let's cut that and we will paste it in here.
01:22You know above it, we will put in a couple of other video files.
01:26So we will say source and then src= explorer.ogv and this is our og file and the
01:37next one is source src= explorer.webm and close that.
01:50The most important one that we want to try first is our IOS stream.
01:53Right, so we will put that first.
01:55So I will say source src= and we will put the full path to this one
02:03http://10.1.111.126 is my IP address hls-vod/explore.f4v.m3u8 and we will
02:10 close that tag.
02:29Now one note about creating ogv and webm videos, I use a free utility called
02:34Firefogg which is available at firefogg.org
02:37You have to use Firefox to use it but it's a quick and easy way to encode your
02:41videos into these two formats.
02:42Other good options are videoRx.com and vid.ly
02:46I have of course included these two files in with your exercise files.
02:52So we can just move on from here.
02:54So next we'll need to add the URL to our Flash HDS stream and we will do that up
02:59here in our Flash Embed code.
03:01We can't just play the video stream itself here though.
03:04We need to play it in a video player SWF and that video player SWF needs to
03:08support HDS streaming.
03:10The sample player that ships with a FMS that we have been using in previous
03:13exercises is exactly what we need and earlier we had copied it to the webroot,
03:18so we can just link to it here.
03:19So we're going to replace test.swf and point to our video player.
03:26videoPlayer/swfs/StrobeMediaPlayback.swf
03:42Now Strobe Media Playback contains logic that allows you just passed in as a
03:46variable the name of your stream, so we are going to do that, we just put a
03:49question mark after the name so then src= and then are HDS stream.
03:551011/hds-vod/explore.f4v.f4m.
04:14Now we need to have this in two different places, so we will copy that url and
04:19down here where we see the other test. swf in the other object code we will put
04:23that in there and paste and one last step we want to sure that the size of this
04:29SWF is correct, so we will change it to 640x360.
04:36And we have to do that again in two places 640x360.
04:38Okay we can now save this file.
04:47Now this file is okay where it is, but it's always a hassle to type long URLs on devices.
04:53So to keep the typing to a minimum, let's move this up a level to the top of the webroot.
04:57So to do this, we go to File>Save As and we will go up one level to our webroot
05:05and we will keep the file name the same and we will say Save and Dreamweaver
05:11does prompt us to update our links and this time we want to do that because we
05:15don't want to lose our relative links to some of our JavaScript.
05:18So we will say yes and you can see it added the past to our exercise files to
05:24link to this SWF object JS.
05:26One thing it did not do though if you notice is update these links to our actual
05:30videop file, so let's do that quickly just so nothing breaks.
05:33So let's say 13_02 13_02/
05:44Now our other links are full paths so we are all set there so we will go ahead
05:48and say save this file.
05:51And now that our flash and HTML files URLs are all in place, we're ready to test on device.
05:56So here I am on my Android device and in a web browser we can type the URL to
06:03the page that we just created.
06:04So that's http://10.1.111.126/uni_vod. html touch go and there we have our video
06:24playing in Flash on Android.
06:28Let's try it on iPad.
06:29In Safari we will type that same URL and we get the HTML 5 version of the
06:35player, we can touch Play.
06:40So you can see that this video now plays virtually anywhere using this
06:43universal player code.
06:45Next let's try a live stream.
Collapse this transcript
Publishing a live stream with universal player code
00:01Now that you've gotten a look at how our Universal Video Player works for
00:03on-demand content let's configure it to play a live stream.
00:07Now if you've been following along you may still have your live stream
00:10broadcasting over in Flash Media Live Encoder.
00:12If so, great, we are going to view it now in this Universal Video Player, if not
00:17you want to go back to the previous lesson where we set up our Flash Media Live
00:19Encoder and follow the instructions.
00:21Once you're publishing a live stream come back to this lesson to test it in the
00:25Universal Video Player.
00:27Okay, so we'll start where we left off in the previous lesson and we'll just
00:30make a few changes to our uni_vod.html file.
00:34So open that up in your HTML Editor, I have it here it's also in this lesson
00:40files for your reference and let's save this file as uni_live and again we're
00:47still working on the upper level of the webroot here just to keep our URLs
00:50simple and we'll say Save.
00:52So let's first set up the Html5 video tag for playback on iOS.
00:58So we'll scroll down to that video tag and we'll change this URL to the URL
01:04of our live stream.
01:05It's hls-live/livepkgr/_definst _/liveevent/livestream.m3u8
01:31You may notice that the vod stream had a 4v in here, we don't need that anymore
01:39for the live, it's simply M3u8 and of course we don't need the Ogg and WebM so
01:44we'll delete those and next we need to add the URL to our live Flash hds stream.
01:50So using our same video player we just need to change this URL, now it's
01:55hds-live/livepkgr/_definst_liveevent/ livestream.f4m and again we need this in
02:17both places so we'll take this whole URL, select it, copy it and paste it down
02:24here in oue other object code here.
02:28Now we can save the file and we have all our URLs in place so we are ready to test.
02:36So here on my iPad I type in the URL 10.1.111.126/uni_live.html
02:48Here we are in iOS where our JavaScript is detected to that Flash is not
02:55installed, so it's playing the steam in the HTML5 video tag.
03:00You can now send a single stream and broadcast it live across devices using
03:03FMS 4.5 and using some simple built-in detection play the right stream on the right device.
03:10And there are a lots of other sophisticated features that you can add to these
03:13players but this should get you started.
Collapse this transcript
Conclusion
Where to learn more
00:00This concludes the Up and Running with Media Server 4.5 course,
00:04and we had a good look at flash media server 4.5 inside now.
00:09He may be hungry for more, at least I hope you are.
00:11Here are some related courses and additional resources that I buy you find helpful.
00:15First, there are some and of course this is including HTML 5 video and Audio in Depth with Steve Heffernan and
00:22my other courses, Flash Forward 2007; Fun with Flash Media Server,
00:27and Publishing Video on the Flash Platform
00:29and that last one will help you get your videos up on the web.
00:33I found that connecting with an online community can help you get the most out of FMS and can save you many many
00:38painful hours of frustration.
00:40When you hit a wall with FMS and you'll quickly find the others have already climbed that wall
00:44and are usually very enthusiastic about helping you over it.
00:48Some great communities of FMS developers include the Adobe Developer Connection,
00:52which is full of FMS articles, tutorials and forums.
00:56The Flash Media Server User Group on Adobe Groups,
00:59and the flash media lists at flashguru.com
01:02And finally, if you want to keep up with the latest developments in Web Video, visit my blog learn LearnFromLisa.com
01:08And sign up for my almost weekly newsletter full of tips and tricks for publishing video online in flash and in HTML 5 and beyond
01:17Thanks for getting up and running with me, and see you again soon.
Collapse this transcript


Suggested courses to watch next:

Publishing Video with the Flash Platform (2h 12m)
Lisa Larson-Kelley


HTML5: Video and Audio in Depth (2h 7m)
Steve Heffernan


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 98,695 instructional videos.

start free trial learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 1,899 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.


site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked