Sources: auto choose .ogg or .webm?

2 posts, 0 answers
  1. Kevin F
    Kevin F avatar
    61 posts
    Member since:
    Sep 2009

    Posted 29 Jun 2018 Link to this post

    If I have a video in only two formats (ogg and webm), can I add both as sources and have the media player automatically detect which one to use?  Or do I need to do the necessary browser checks before adding the source to the player?

  2. Georgi
    Admin
    Georgi avatar
    580 posts

    Posted 03 Jul 2018 Link to this post

    Hello Kevin,

    Possible solution is to append all the sources to the generated video tag using jQuery after the widget is initialized.

    e.g.

    var vid = $('#mediaplayer video');
          vid.removeAttr('src');
          vid.append('<source src="http://techslides.com/demos/sample-videos/small.webm" />');
          vid.append('<source src="http://techslides.com/demos/sample-videos/small.mp4" />');

    Below you will find a small sample which demonstrates the above approach:



    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top