Follow

Video

Video should be streamed where possible, although can be embedded into the app if required. We provide example code implementations on GitHub for:

  • Streamed .mp4 file
  • Embedded .mp4 file
  • Brightcove
  • Vimeo
  • Youtube
  • Youtube API

All of this is publicly available here.

You can use the HTML5 video tag:

<video poster="image.jpg"width="320"height="240" controls>
 <source src="movie.mp4"type="video/mp4">
 <source src="movie.ogg"type="video/ogg">
Your browser does not support the video tag.
</video>

The filetypes you include in the src should be relevant for the platforms you are aiming at, for example, .mp4 is good for iPad, so .ogg is irrelevant. You can use the poster image functionality and the controls as usual.

If you want to use an existing video API such as YouTube or Brightcove, you will need to use the relevant embed code for that API. 

Offline messaging

Remember your HTML may run in an online or offline state. Use Javascript to detect the online state as in the example below:

  if(navigator.onLine){
     video.play();
   }
   else{
     alert("Please go online to view the video");
   }

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk