Sunday, January 31, 2016

Video filters - image adjustments using CSS3 filters

CSS3 filters can be used on native HTML5 video objects as well as on images. 
I've recently created a little widget that opens an image adjustments menu on top
of the playing video (thank you Muli Dayan for your help with this one!).

The widget allows video image manipulations using these CSS3 filters:

  • Brightness
  • Contrast
  • Greyscale
  • Saturation
  • Hue-rotate
  • Sepia
Chrome and Safari except CSS filers by defining the "webkitFilter" property.
FireFox requires definition of the "filter" property.
IE is not supported as it lacks support for CSS3 filters.

Feel free to play with the demo and download the source code from Github.


Monday, January 11, 2016

Inline video playback on iPhone - my solution

As iPhone users know, when viewing an online video on the iPhone, the video plays in full screen using the device native player.

This presents a major limitation for advertisers since video ads are not clickable and overlay ads cannot be displayed. 
Any custom user interaction during video playback is not supported which prevents interactive videos and games.

There are few approaches for a solution, and here is mine, which I hope you find helpful.

Demo (open on an iPhone): http://amirch1.github.io/VideoInline/
Github code under MIT license: https://github.com/amirch1/VideoInline

The solution:

  1. Create an Audio tag and give it the source of the Video tag. Audio tags support any video format (mp4, m3u8 HLS streams, live) and play inline.
  2. Hide the Video tag native controls using Shadow DOM CSS rules.
  3. Add custom Play / Pause button and a progress bar.
  4. Clicking the Play button triggers the Audio tag play() method. It also invokes the Video tag load() method which enables video seek operation.
  5. A timed interval is set to sync the Video tag currentTime property to the Audio tag currentTime property. The time interval actually defines the playback frame rate enabling balance between quality and performances. It also updates the progress bar.
  6. Seeking using the progress bar sets the Audio tag currentTime value. The Video tag updates accordingly by the timer refresh.
Thats it! 
Rather simple, provides real audio sync and supports all video formats including mp4, HLS and live streams.
Can be easily enhanced to support fullscreen playback without loosing interactivity and additional video controls.

Feel free to play with the code, submit pull requests and star the Github repository :)

Monday, January 4, 2016

Moving to Github Pages

I've just started using Github Pages.
My first project is an updated Video Color Sampler and I will add additional projects soon.



About Me

My photo
I've been developing Internet and rich-media application for 15 years. In my work I emphasis usability and best user experience as well as sleek design. My main expertise are JavaScript, Flex and Flash.

Followers