Hiding video players

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Hiding video players

Post by rj »

I recently changed format by putting all the videos down under in extended. Allowed me to put 25 articles on the front page rather than 10, which google likes. Though it works fine for the 75% of my traffic that comes into articles from search engines, they see things pretty much the same as before, my regulars don't like it, those extra two clicks they tell me are VERY ANNOYING! !!

Video Players are about 80k and they have to pre connect. 10 of them on the front page slow things down.

This is HTML rather than Serendipity but... Can this be done?

Create a universal JPG for each of the players you use. 100px square youtube at 10kb.

youtube.jpg

which has a big play button in the center. The same graphic will often be repeated down the page without needing to be reloaded.

Place the JPG at the top left of a blog article. With the article wrapping around it.

When clicked it loads the embed code with the full size player in a new window (_top).
<object>youtube</object>

How would that be done? This could solve lots of problems for lots of blogs... Or already has and I am way behind! :)

Thanx

RJ

rackjite.com
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Hiding video players

Post by garvinhicking »

Hi!

This can surely be done, by masking a link and using javascript to only load the player on demand.

I'm quite sure there is existing example code for that, you might want to search the Youtube API documentation or check their forums.

The idea is a code like this:

Code: Select all

<html>
...
<head>
...
<script type="text/javascript">
function makeYoutube(video_id) {
  document.getElementById('player_' + video_id).innerHTML = '...all that embed stuff,using the variable "video_id" at the proper place for the source...';
}
</script>
...
</head>
...
<body>
...

Entry1: <a href="#" onclick="makeYoutube('4711')"><img src="youtube.jpg" /></a>
<div id="player_4711"></div>

Entry2: <a href="#" onclick="makeYoutube('0815')"><img src="youtube.jpg" /></a>
<div id="player_0815"></div>
This is pure HTML/JavaScript and independent from Serendipity, it would work accross all blogs. I'm really sure there must be something like that. SWFobject already encapsulates code calls like this, maybe you can find a proper implementation for my pseudocode on google. I don't really know what to google for, "youtube player on click" doesn't yield any important results for me.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Re: Hiding video players

Post by rj »

Thanx, I will look into this and get back to you... Thing is it has to work with ComedyCentral, NBC and YOUTUBE code...
Post Reply