How do streaming videos work?
Asked Answered
A

1

7

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.

Adscription answered 1/3, 2009 at 7:56 Comment(0)
V
14

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.

Vive answered 1/3, 2009 at 8:11 Comment(3)
Thanks for that. 1 more question, is there anyway I can protect the flv file from being downloaded by someone unauthorized? It should be available to members onlyAdscription
If someone can watch the movie, they can download it. Likewise, if they can download it, they can watch it. Standard cookie-based authentication on the server side would work, but how exactly to do that in your situation is a whole 'nother question.Vive
I hope someone is not watching that movie!Depository

© 2022 - 2024 — McMap. All rights reserved.