Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

(ANCC,HTML5)How to detect browser support(video,audio).

Enthusiast ,
Oct 15, 2020 Oct 15, 2020

video,Ogg,MPEG 4,WebM

video,Ogg,MP3,Wav。

Different browsers use different types.

Hope to detect the type supported by the current browser,
Automatic playback to this type of file.

How the code is written in ANcc html5.

For example:  

<audio controls="controls">
  <source src="song.ogg" type="audio/ogg">
  <source src="song.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>

 

481
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 16, 2020 Oct 16, 2020

you can use the canPlayType of a document element but the audio tag allows the user's browser to select the first supported type.

Translate
Community Expert ,
Oct 16, 2020 Oct 16, 2020

you can use the canPlayType of a document element but the audio tag allows the user's browser to select the first supported type.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 16, 2020 Oct 16, 2020

Thank you, it's being used to solve the problem.

Now I can automatically switch to a supported format.

3Q.

4444.PNG

 

 

edge 

5555.PNG

ie11

6666.PNG

google chrome

777.PNG

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 16, 2020 Oct 16, 2020

All modern browsers support MP3 and MP4. Just use those and don't worry about it.

 

https://caniuse.com/mp3

https://caniuse.com/mpeg4

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 16, 2020 Oct 16, 2020

Thank you for your answer.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 16, 2020 Oct 16, 2020
LATEST

you're welcome 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines