Wednesday, February 14, 2007

Building the ultimate flash video/audio player

I know the title it's pretentious. But I got you to read this, didn't I?

The goal is to make a decent feature complete flv/mp3 player in Flash 9. Why there isn't one already? Basically, because the Flash Player doesn't take advantage of DirectX (or any significant video acceleration) and it isn't a viable solution for good quality, full screen viewing. There are video players for web and some desktop players as an aid to developers. Also some savvy users use them for whatever flvs they got from youtube and such.

Why do I want to make one? Well, I'm a geek. And it's not that hard either. Before getting to work, let's put some specs together:


A. General features:
0. Formats played: flash video (Sorenson Spark and On2 VP6 codec), MP3
1. Streaming, progressive download
2. Dynamic buffering (adaptive, "intelligent")
3. Skinning (of course)
4. Smoothing, deblocking both adaptive and set by user
5. User settings stored on local computer (also history saving)
6. Playlist
7. Zoom options: 50%, 100%, 200%, to fit, full screen
8. Format accomodation (if you have a 4:3 or 16:9 TV and the image coming from cable or DVD player is the other format, then you have some options like: 14:3, zoom, inteligent)
9. Side notes support (those are encoded as metadata directly into the flv)
10. Subtitle support (sub, srt, xml)
11. Multiple selectable audio tracks (yeah, the sync job...)
12. Media properties: original fps, current fps, codecs, everything meta
13. Key binding (configurable)
space, p, click - play/resume
left key - back 10 seconds
right key - forward 10 seconds
ctrl+left - back 1 frame
ctrl+right - forward 1 frame
up key - volume up 10%, maybe logarithmic at some point
down key - volume down 10%
page up - forward 10 minutes
page down - back 10 minutes
ctrl+` - zoom 50%
ctrl+1 - zoom 100%
ctrl+2 - zoom 200%
ctrl+enter, f - toggle fullscreen
ctrl+s - toggle mute
o - toggle OSD
v - toggle subtitles
.... and the list goes on ...
14. Recording video/audio (needs FMS/FCS/Red5/etc.) This opens a whole new branch of features.
15. Plug-ins to insert the player into different CMSs.

B. Things I need feedback on:
1. Automated detection of blank frames (or any other color) in order to skip the part or just to accurately trigger thumbnail generation
2. Fake streaming. No FMS needed, just some preprocessing and a small script (PHP let's say). This has the advantages of both worlds: near instant seeking and, at the same time, caching.
3. User notes on timeline, also saved locally.
4. Extensions support. This is kind of crazy...
5. Desktop implementation
6. Other supported formats: swf, jpg, gif, png (boring...)
7. Uploading: do you see any real advantage to that?
8. Zooming, scan & pan (keeping display area fixed)

C. Things I don't know yet how to do, if even possible:
1. Slow/fast motion

D. What other feature would you want? If it's useful, I'm obsessed enough to do it. Please comment and help me gather the specs for a great player.

Some references:
1. Jeroen Wijering player - embedding type, I really like it
2. Martijn de Visser player - desktop type

PS: Will I share the sources? I never once protected my work or refused to share knowledge. Nor does it have to be me the only author. So basically yes, unless the company asks me to do this at work and then decide not to share.

No comments: