Video Player: HTML5 vs Youtube API

I need to display a video on a simple website (in fact, the video will be the only object), listen to the following events, and store a timestamp (user clock in milliseconds) every time:

  • Buffering complete
  • The first game()
  • Pause()
  • Summary()
  • Stop () (this means the user has fully watched the video)

Compatibility: Users can open the website on any system (like older browsers).

My question is which technology do you recommend to achieve these requirements: native HTML5 (using video tag) or Youtube API?

Bonus requirement: do not allow the user to move the cursor forward or backward (the only allowed operation is pause / resume).

+3


source to share


1 answer


To meet the support requirements of older browsers, you need to provide a flash fallback as HTML5 video is not fully supported (see caniuse ). The YouTube API will provide a backup out of the box (in fact, I think it's the default for Flash).

If you plan on using HTML5 video, you will need to provide a backup yourself. Your best bet is to use one of the popular HTML5 video libraries, many of which will help you with this, and which provide a consistent API regardless of the delivery mechanism. Video.js and jPlayer are both popular options.



Other requirements are fully realizable using either option. With the YouTube API, I think you will need to follow this tutorial to implement custom controls to restrict the user's ability to control play / pause. Other APIs may allow you to more easily select and select from the controls supplied out of the box (i.e. to remove the scraper by configuration). In both cases, you will be able to capture all the events that you list in your paragraphs.

The advantage of using YouTube, depending on your requirements, is that the video is hosted for free on YouTube. In addition, you may need to post the video on social media as well as on your own website as this can lead to wider exposure.

+2


source







All Articles