Class MediaCapabilities
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The MediaCapabilities interface of the Media Capabilities API provides information about the decoding abilities of the device, system and browser. The API can be used to query the browser about the decoding abilities of the device based on codecs, profile, resolution, and bitrates. The information can be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient.
[Value("MediaCapabilities")]
public class MediaCapabilities
- Inheritance
-
MediaCapabilities
- Inherited Members
Remarks
The information is accessed through the mediaCapabilities property of the Navigator and WorkerNavigator interface.
-HTMLMediaElement's method canPlayType()
-MediaSource's method isTypeSupported()
-Navigator interface
Constructors
MediaCapabilities()
public MediaCapabilities()
Methods
DecodingInfo(MediaDecodingConfiguration)
The decodingInfo() method of the MediaCapabilities interface returns a promise that fulfils with information about how well the user agent can decode/display media with a given configuration.
[Value("decodingInfo")]
public Task<MediaCapabilitiesDecodingInfo> DecodingInfo(MediaDecodingConfiguration configuration)
Parameters
configurationMediaDecodingConfiguration
Returns
- Task<MediaCapabilitiesDecodingInfo>
A 'Promise' fulfilling with an object containing the following attributes:Browsers will report a supported media configuration as
smoothandpowerEfficientuntil stats on this device have been recorded.
All supported audio codecs reportpowerEfficientas true.
Remarks
The resolved object contains three boolean properties supported, smooth, and powerefficient, which indicate whether decoding the media described would be supported, and if so, whether decoding would be smooth and power-efficient.
The method can also be used to test the user agent capabilities for decoding media encoded with a key system, but only when called in the main thread and in a secure context.
If the configuration passed in the configuration.keySystemConfiguration property is supported for decoding the data, the resolved promise also includes a MediaKeySystemAccess object that can be used to create a MediaKeys object to setup encrypted playback.
NOTE
Calling
decodingInfo()with this property may result in user-visible effects, such as asking for permission to access one or more system resources.
As such, this function should only be called when the application is ready to create and use aMediaKeysobject with the provided configuration.
-EncodingInfo(MediaEncodingConfiguration)
-CanPlayType(string) for file
-IsTypeSupported(string) for media-source
-RequestMediaKeySystemAccess(string, List<MediaKeySystemConfiguration>)
EncodingInfo(MediaEncodingConfiguration)
The encodingInfo() method of the MediaCapabilities interface returns a promise that fulfills with the tested media configuration's capabilities for encoding media.
This contains the three boolean properties supported, smooth, and powerefficient, which describe how compatible the device is with the type of media.
[Value("encodingInfo")]
public Task<MediaCapabilitiesEncodingInfo> EncodingInfo(MediaEncodingConfiguration configuration)
Parameters
configurationMediaEncodingConfiguration
Returns
- Task<MediaCapabilitiesEncodingInfo>
A 'Promise' fulfilling with an object containing three Boolean attributes:Browsers will report a supported media configuration as
smoothandpowerEfficientuntil stats on this device have been recorded.
All supported audio codecs are reported to be power efficient.