This is a migrated thread and some comments may be shown as answers.

Sources: auto choose .ogg or .webm?

1 Answer 28 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Kevin F
Top achievements
Rank 1
Kevin F asked on 29 Jun 2018, 07:26 PM

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?

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 03 Jul 2018, 02:30 PM
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.
Tags
MediaPlayer
Asked by
Kevin F
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or