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

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

Enthusiast ,
Oct 15, 2020 Oct 15, 2020

Copy link to clipboard

Copied

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>

 

Views

261

Translate

Translate

Report

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.

Votes

Translate

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

 

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

https://caniuse.com/mp3

https://caniuse.com/mpeg4

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank you for your answer.

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

you're welcome 

Votes

Translate

Translate

Report

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