Video in web page

All about creating websites!
Post Reply
User avatar
z3r0aCc3Ss
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 700
Joined: 23 Jun 2009, 16:00
14
Contact:

Video in web page

Post by z3r0aCc3Ss »

I want to make a website similar to this:

Code: Select all

http://ivang-design.com/chronos/video/index.html
I know how to embed video as a background.

I have a few questions:
1) How to optimize video for web page background?
2) Which format?
3) How much size?
4) Autoplay and buffering as soon as page and video loads
5) The moment you leave the page or lose focus, video should stop there itself and start from there as soon as it gets focus.

Help appreciated... :)
Beta tester for major RATs, all kinds of stealers and keyloggers.
Learning NMAP

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Video in web page

Post by bad_brain »

personally I have never used one, but it's definitely done with jQuery, so this one might be a good start:
http://www.jquery4u.com/media/background-video-plugins/" onclick="window.open(this.href);return false;

hopefully one works fine for you...:)
Image

User avatar
CommonStray
Forum Assassin
Forum Assassin
Posts: 1215
Joined: 20 Aug 2005, 16:00
18

Re: Video in web page

Post by CommonStray »

I have a few questions:
1) How to optimize video for web page background?
2) Which format?
3) How much size?
4) Autoplay and buffering as soon as page and video loads
5) The moment you leave the page or lose focus, video should stop there itself and start from there as soon as it gets focus.

You can do this with jPlayer.org with some tinkering (and its a fairly good HTML5 video player, no brandings on your player etc...) with a flash fallback.

You can also do the focus stops and starts with some jQuery triggering as it watches events like that.

Higher resolutions of video will look better in full screen mode, which means it will look better in a full page layout (720p, 1080i, 1080p), format will depend, but you'll likely be looking at mpeg-4 since its a widely used format, you can check other supported formats on the jplayer.org website.

One thing to consider with your video resizing is its aspect ratio. You're vid player should do this automatically but in case it doesnt you have to make sure when you're reszing the video you keep your heights and widths proportional to its ratio. Here is a proportion calculation snippet i wrote up a while back, it shouldnt be difficult to port this to javascript

Code: Select all

<?php
/**
* Returns a proportional width or height.
* 
* @param int $width Known width
* @param int $height Known height
* @param int $x New width or height
* @param string $type Default find height or width
* @returns int $result The resulting new width or height
*/
function get_proportional($width, $height, $x, $type = "height")
{
    // Find the ratio from known height and width
    $ratio = $height / $width;
    
    if($type == "height")
    {
        //Determine new height from desired($x) width * the ratio
        $result = $x * $ratio;
    }
    else
    {
        //Determine new width from desired($x) height / the ratio 
        $result = $x / $ratio;
    }
    
    return $result;
}

?>
Hope that helps

Post Reply