TOP provides some helper utilities on TOP.Support for determining if a browser is suitible for media playback. All of the API methods here will return a Promise.
Available support API's:
| API | Description |
|---|---|
| mse | Needed to play HLS content |
| autoPlay | If user gesture required to play content |
To use a support API, set a Promise.then listener for a specified API:
TOP.Support.<api>.then(function(value) {
console.log('Is API supported?', value);
});MSE support is required for TOP to play HLS content in most browsers (except iOS Safari which has native support for playing HLS content). Check if the browser supports mse:
TOP.Support.mse().then(function(value) {
if (TOP.utils.Browser.ios() && TOP.utils.Browser.safari())
console.log('HLS supported natively, no MSE needed');
else
{
if (value)
console.log('MSE is supported, TOP can use HLS or similar');
else
console.warn('MSE not supported, TOP cannot use HLS');
}
});Detects if autoPlay is supported for specific browser / device:
TOP will do this check automatically, see Scenarios, AutoPlay
TOP.Support.autoPlay().then(function(value) {
if (value)
console.log('AutoPlay is supported, content will play');
else
console.warn('AutoPlay not supported, requires user gesture');
});