tags:

views:

38

answers:

1

Hi.

I need to play videos stored on a web server from a web browser.

I was thinking of using Flash to achieve this. I found this article http://www.republicofcode.com/tutorials/flash/video_flvplayback/

Is there a better approach? Also when the video is playing or is paused, I'd like to be able to read the current time of playback from the browser (I guess through Javascript). Would Javascript be able to retrieve this time from the flash player?

Thanks and regards, Krt_Malta

A: 

No, no and no. Flash is the worst way to embed videos in websites, as the plugin creates speed and security drawbacks. Try using the HTML <video> tag, which embeds video without the need for any plugin. The syntax is as follows:

<video width="..." height="..." src="..."></video>

autoplay, controls, loop and preload are optional attributes.

To get the current elapsed time, use the currentTime property of the tag:

myVideo.elapsedTime

To get the duration of the video, use the duration property:

myVideo.duration
Delan Azabani
I see. Yes I came across this. Should I worry about it being specific to HTML5? Although it doesn't matter to me much, so if it's simpler and more straightforward I'll use that. Thanks :)
Krt_Malta
No. All browsers except IE support this, and support for IE will come in the next version, version 9.
Delan Azabani
Looks great on Google Chrome :) Thanks a bunch
Krt_Malta