summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/common/media.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/common/media.js')
-rw-r--r--testing/web-platform/tests/common/media.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/common/media.js b/testing/web-platform/tests/common/media.js
new file mode 100644
index 000000000..6bddea5fd
--- /dev/null
+++ b/testing/web-platform/tests/common/media.js
@@ -0,0 +1,35 @@
+//
+// Returns the URI of a supported video source based on the user agent
+//
+function getVideoURI(base)
+{
+ var extension = '.mp4';
+
+ var videotag = document.createElement("video");
+
+ if ( videotag.canPlayType &&
+ videotag.canPlayType('video/ogg; codecs="theora, vorbis"') )
+ {
+ extension = '.ogv';
+ }
+
+ return base + extension;
+}
+
+//
+// Returns the URI of a supported audio source based on the user agent
+//
+function getAudioURI(base)
+{
+ var extension = '.mp3';
+
+ var audiotag = document.createElement("audio");
+
+ if ( audiotag.canPlayType &&
+ audiotag.canPlayType('audio/ogg') )
+ {
+ extension = '.oga';
+ }
+
+ return base + extension;
+}