Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do streaming videos work?

So I have some videos in .flv format which I'd like people to be able to view from my site, without being able to download them. So far Flowplayer seems like the best choice for the actual flash player.

However, I've been looking into this video streaming thing, as its supposed to make the videos very fast to view and allows seeking to the middle of the video, etc. What do I need to make it work, do i need to have some special server software for this? And how can I integrate with this software using the javascript/PHP code that i'll use to display the videos?

Thanks.

like image 582
Ali Avatar asked Mar 01 '09 07:03

Ali


People also ask

Is streaming a video the same as watching it?

Streaming is a way to watch or listen to content without having to download it. You'll often hear the term "streaming" in relation to watching movies and listening to music on the internet. Streaming is a fast way to access internet content. The content is delivered to your device quickly, but it isn't stored there.

How do you get streaming on your TV?

Your streaming device connects to the internet through either an ethernet cable or Wi-Fi. It connects to your television through the HDMI port. Connect your device to a power source and the HDMI port on your television, then use the TV remote to change the source or input to the corresponding HDMI port.

How does video streaming work on Netflix?

Netflix uses the internet to stream movies and TV shows from our servers to your screens, but we can't do it alone. From our servers to the world wide web to your ISP's (Internet Service Provider) network, our content travels across multiple touch points to get to your screen.


1 Answers

Good news! You don't need special software, most reasonable web servers can do all of that out of the box. What you're describing, and what Youtube and the rest do, isn't streaming actually. It's called progressive download.

Basically the SWF player (flowplayer in your case) is downloading the FLV video, and playing what it has downloaded so far. To skip to some video that it has already downloaded, it seeks in the downloaded file. To skip beyond what has already been downloaded it discards the downloaded file and starts a new download, but it asks the HTTP server to start giving it the file at a certain offset. Thankfully, most HTTP servers can do this out of the box.

So you just need to put the FLV files somewhere that's publicly available to download via HTTP (just test this with your browser). Assuming you put flowplayer at /flowplayer.swf on your site, and the video is /2girls1cup.flv you would insert this into your page:

<script src="http://static.flowplayer.org/js/flowplayer-3.0.6.min.js"></script>

<!-- Edit this with the width and height to display the video -->
<a  
    href="/2girls1cup.flv"  
    style="display:block;width:425px;height:300px;"  
    id="player"> 
</a> 

<!-- this script block will install Flowplayer inside previous anchor tag --> 
<script language="JavaScript"> 
    flowplayer("player", "/flowplayer.swf"); 
</script>

I took this example from the flowplayer demos page where there's lots more examples of lots of ways to customize flowplayer, the way it behaves and is displayed.

There are two ways in which an actual streaming server is better. One is for doing multicasts of a stream, in which all clients are at the same place in the video, which is easier on the server. The other is being able to deliver a number of different encodings of the same stream, so that, for example, clients can the video at a bitrate that best matches their playback capability.

A lot of companies bet a lot of money that this would be very important for video to take off on the web. It looks like all of them are wrong. Streaming servers are mostly used in the enterprisey world, which might explain their enterprisey prices.

like image 76
Peter Burns Avatar answered Sep 30 '22 00:09

Peter Burns