-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c0c7bb
commit 70fbcbc
Showing
5 changed files
with
126 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import document from 'global/document'; | ||
|
||
// check if the browser supports cors | ||
export const corsSupport = (function() { | ||
const video = document.createElement('video'); | ||
|
||
video.crossOrigin = 'anonymous'; | ||
|
||
return video.hasAttribute('crossorigin'); | ||
})(); | ||
|
||
export const isHLS = function(currentType) { | ||
// hls video types | ||
const hlsTypes = [ | ||
// Apple santioned | ||
'application/vnd.apple.mpegurl', | ||
// Very common | ||
'application/x-mpegurl', | ||
// Included for completeness | ||
'video/x-mpegurl', | ||
'video/mpegurl', | ||
'application/mpegurl' | ||
]; | ||
|
||
// if the current type has a case insensitivie match from the list above | ||
// this is hls | ||
return hlsTypes.some((type) => (RegExp(`^${type}$`, 'i')).test(currentType)); | ||
}; | ||
|
||
export const validProjections = [ | ||
'360', | ||
'360_LR', | ||
'360_TB', | ||
'360_CUBE', | ||
'NONE', | ||
'AUTO', | ||
'Sphere', | ||
'Cube', | ||
'equirectangular' | ||
]; | ||
|
||
export const getInternalProjectionName = function(projection) { | ||
if (!projection) { | ||
return; | ||
} | ||
|
||
projection = projection.toString().trim(); | ||
|
||
if ((/sphere/i).test(projection)) { | ||
return '360'; | ||
} | ||
|
||
if ((/cube/i).test(projection)) { | ||
return '360_CUBE'; | ||
} | ||
|
||
if ((/equirectangular/i).test(projection)) { | ||
return '360'; | ||
} | ||
|
||
for (let i = 0; i < validProjections.length; i++) { | ||
if (new RegExp('^' + validProjections[i] + '$', 'i').test(projection)) { | ||
return validProjections[i]; | ||
} | ||
} | ||
|
||
}; |
This file was deleted.
Oops, something went wrong.