You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I created a web video player that focus on playing local video files (not online streaming media).
I want to know whether a video element can play a local file. Currently, I use try-catch statement to detect it. But sometimes it can play audio track but can't play video track, and don't throw error.
The problem is isTypeSupported(), canPlayType() and decodingInfo() asking for a (MIME type + codec) string as a parameter. But for local files scene, I don't know this info in advance. To get this info, I need to analyze the file content, for example use mp4box.js or mediainfo.js library.
So I would like to propose a new method canPlay(file). The parameter is a file object URL or a file. If Media Capabilities API supports whether browser can play a local file, I don't need to know (MIME type + codec) in advance.
Use case is:
if (browser can play this file) {
play it
} else {
prompt user: "cannot play this file"
}
The text was updated successfully, but these errors were encountered:
Hi, I created a web video player that focus on playing local video files (not online streaming media).
I want to know whether a video element can play a local file. Currently, I use try-catch statement to detect it. But sometimes it can play audio track but can't play video track, and don't throw error.
The problem is
isTypeSupported()
,canPlayType()
anddecodingInfo()
asking for a (MIME type + codec) string as a parameter. But for local files scene, I don't know this info in advance. To get this info, I need to analyze the file content, for example use mp4box.js or mediainfo.js library.So I would like to propose a new method
canPlay(file)
. The parameter is a file object URL or a file. If Media Capabilities API supports whether browser can play a local file, I don't need to know (MIME type + codec) in advance.Use case is:
The text was updated successfully, but these errors were encountered: