Highlighted

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

Enthusiast ,
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>

 

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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

Views

53

Likes

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

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

Enthusiast ,
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>

 

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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

Views

54

Likes

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
Oct 15, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Oct 16, 2020 0
Enthusiast ,
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

 

 

 

Likes

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
Reply
Loading...
Oct 16, 2020 0
Adobe Community Professional ,
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

 

Likes

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
Reply
Loading...
Oct 16, 2020 0
Enthusiast ,
Oct 16, 2020

Copy link to clipboard

Copied

Thank you for your answer.

 

Likes

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
Reply
Loading...
Oct 16, 2020 0
kglad LATEST
Adobe Community Professional ,
Oct 16, 2020

Copy link to clipboard

Copied

you're welcome 

Likes

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
Reply
Loading...
Oct 16, 2020 0