Blue Green Brown Orange

Change Background

Posts Tagged ‘JavaScript’

25

August
2

Embed Videos With Flowplayer

For anyone developing or maintaining a website, embedding videos used to always be an issue. That was until YouTube became the undisputed leader for sharing videos, and embedding them in websites. Normally, using a free service with a recognizable appearance and a visible watermark, like YouTube, is unprofessional. However, YouTube has become so popular, that even the large corporations and professional entities display their clips using it.

Embedding with YouTube is easy, but limited

YouTube is easy but limited

The reasons to YouTube’s success as a “video distributer” are due to the simplicity of the process, the familiarity with it by the regular users, and the relative flexibility in terms of size and appearance. Anyone can simply create a free YouTube account, upload a video, customize the interface by choosing the border color and display size, and then embed it into any website using the generated code. Seems like the ideal solution.

However, there are a number of disadvantages to the YouTube way of life:

  1. The video is on Google’s server, and not yours: Even if their servers are rarely down, it’s always comforting to be in possession of your own content
  2. Customization is limited: You have eight colors to choose from, and no say over the appearance of the border or controls
  3. Somewhat rigid: In order to make any changes, you need to go back to YouTube, and re-copy and paste the code
  4. Watermark and standard look: Nothing’s worse than having everything look the same. With YouTube, the watermark is very visible, and all of the players are virtually identical
Flowplayer: Open Source Flash Video Player

Flowplayer: Open Source Flash Video Player

This is where Flowplayer comes to the rescue. Flowplayer is an open-source JavaScript library that allows you to embed videos in your website via a full customizable player. It is as easy as calling on the JavaScript file, inserting an <a> tag, and then indicating the properties that you want to define. This basically means that instead of uploading a video to YouTube and embedding the player, you can upload the .flv to your web server and the markup will look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<!-- flowplayer scripts should be loaded from your servers NOT from static.flowplayer.org  -->
<script type="text/javascript" src="/js/flowplayer-3.1.2.min.js"></script>
</head>

<!-- some styling for the standalone page. this line can (or must) be removed -->
<link rel="stylesheet" type="text/css" href="/demos/standalone.css"/>

<!-- player container-->
<a href="http://flowplayer.org/video/flowplayer-700.flv" style="display:block;width:425px;height:300px;" id="player"></a>

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

You can see the result here.

Notice that you call on the JS file in the <head>, and then you use the <a> to embed the player (you can also use <div>), and finally, some JavaScript to specify any attributes that you want to use.

Some of the features include:

  • Embedding several videos in the same page without effecting performance
  • Choosing the splash image that, when clicked on, starts the video
  • Placing an image in the background, with a layer on top (ideal for a single “play” sign to be placed on any image)
  • Embedding a playlist of videos
  • A growing list of plugins to be used with the player
  • Control such details as the fade in/fade out speed, cue points, and much more

Just by open-sourcing it (there’s also a commercial version), and allowing for the community to contribute with plugins on different levels means that the sky is the limit as far as embedding videos in websites is concerned. It might take a bit of time before it catches on with the regular users (who are very rarely willing to dig into the code), but for designers and developers, it should definitely be a tool to replace old-school video incorporation.

The website is very well designed and laid out, and the documentation is quite extensive, but it does seem to lack some usability. That is why when you first visit the Flowplayer website, you become confused as to what it is exactly, and how to works. After looking deeper, however, it has become clear that it is a very powerful tool with endless possibilities.

23

July
1

The Fight Against Spam

It’s a sad but true story that as we witness technological developments, spammers become advance and reach new levels to infiltrate our mail boxes. It is by far one of the most frustrating aspects of the online experience, and unfortunately, it doesn’t look like it will be ending anytime soon.

Spamming started back in 1978 on the network of the time, ARPANET, when an email was sent to 600 address. But it started operating on a massive level in 1994, right around when millions of users were signing up for new email accounts and getting introduced to using the Internet. Today it is estimated that there are more than 100 billion spam messages every single day.

The following is a hilarious report by the Onion News Network on spam:

The best solution so far that has been developed to hold off spam is the Captcha. Basically, by having random numbers and letters covered with scribbles keeps the spammers away. However, it might not be the best solution out there, as it means that many humans are having trouble passing the test. From that perspective, it is clear that spammers are ahead in the battle, even if it is somewhat coincidental. The fact that millions of Internet users repeatedly fail to pass the captcha hurdle means that the spammers have successfully prevented the rest from the harmonious, smooth internet experience.

In order defeat the spammers, there needs to be a test that is incredibly easy for humans, and impossible for spammers. There have been some creative works as of late that will hopefully catch on in the near future. One of which is the Ajax Fancy Captcha:

The Ajax Fancy Captcha method

The Ajax Fancy Captcha method

Not only is it easy, but it is also intuitive. This means that it only requires a few seconds and you won’t break a sweat, while it blocks off those attempting to spam. Seems like the ideal solution, and I’m looking forward to seeing it implemented everywhere on the web.

There’s no doubt that spammers will continue to grow and develop, but the strength of the community of the free and safe internet is far superior. And while we will always be facing periods when spammers have catch up, it will always be followed by another where users carry on their everyday lives without the slightest of worries.

28

June
0

typeface.js: Redefining System Fonts

It seems like JavaScript is really picking up, as more and more developers join open source projects to bring fascinating features to the web. The latest of which is a project called typeface.js that renders the fonts of a given website using JavaScript, <canvas> and VML. This means that, instead of creating images for all of the text that will be using anything other than the default system fonts, developers will be able to embed the font via a type of typeface add-on, and type away!

The project is still in experimental phase, but seems excitingly promising.

Some of the fonts that can be embedded using typeface.js

Some of the fonts that can be embedded using typeface.js

Whenever designing or developing a website, you are inevitably tied to the following fonts:

  • Arial
  • Comic Sans MS
  • Courier
  • Georgia
  • Impact
  • Lucida
  • Tahoma
  • Times New Roman
  • Trebuchet MS
  • Verdana

There are a couple of others, but that is pretty much the safe list. After a while, websites become repetitive as everyone is using the same group of fonts for text (while relying on images for the special ones). Now, with the typeface project, the future looks bright.

Not only that, but the website actually offers a conversion tool that allows you to upload a font for it to be rendered in your website. The project in general is still requiring some work before it’s ready for wide deployment, but as always, open source projects can’t go wrong.

26

June
0

jsAnim: Beginning of the End for Flash?

As I was stumbling upon the web, I came across the jsAnim website. The first impression that comes to mind when you open the website is that of vector-based, colorful Flash animation. Interestingly enough, though, it is yet another example of animation and cool effects achieved through pure JavaScript – no plugins required. Just like jQuery has introduced a wide range of animation effects and interactive content, JsAnim looks to rid the users of Flash, especially if all they’re going to do is relatively basic vector animation.

In an earlier post I made about the Solidays festival website, I talked about an example of impressive and intuitive Flash use. Unfortunately, many websites seem to be using Flash for the wrong reasons, and quite a number of developers have opted to fully rely on CMS-driven websites at the cost of some of those cool effects that can give you the edge in a website or online application. Nowadays, with the rise of JavaScript libraries such as jQuery and JsAnim, you can get the best of both worlds by integrating the JS files and calling upon them when needed. The result would be simple, professional and extremely easy to manage/maintain websites, that boast special effects and animation. This is not to say that Flash, as we now it, will cease to exist. Rather, this allows for developers to make a clear-cut choice: either develop the entire website in Flash, and take advantage of the unique features it gives you, or stick to XHTML and CSS using a CMS with JavaScript libraries integrated. The latter of which is by far the most popular choice.

One of the most impressive features of JsAnim is the small file size of just under 25KB. And unlike jQuery, you’re not going to be installing plugins that may increase the file size and require more time to load, at least not for the time-being. At version 0.2, this is only the beginning, and it can only get better.

My observation is that the difference between a multimedia developer and a web designer is growing bigger and bigger. Future generations of designers will have to make a choice earlier on, as it is going to be almost impossible to specialize in both areas. But who knows? Maybe ActionScript can go back to its JavaScript roots, and we get a Flash that integrates seemlessly into a website without requiring a plugin or any kind of special treatment.