Skip to content

Instantly share code, notes, and snippets.

@gkatsev
Last active August 29, 2015 13:57
Show Gist options
  • Save gkatsev/9790249 to your computer and use it in GitHub Desktop.
Save gkatsev/9790249 to your computer and use it in GitHub Desktop.
test('patchCanPlayType patches canplaytype with our function, conditionally', function() {
var oldAV = vjs.ANDROID_VERSION,
video = document.createElement('video'),
canPlayType = vjs.TEST_VID.constructor.prototype.canPlayType,
patchedCanPlayType,
unpatchedCanPlayType;
vjs.ANDROID_VERSION = 4.0;
vjs.Html5.patchCanPlayType();
notStrictEqual(video.canPlayType, canPlayType, 'original canPlayType and patched canPlayType should not be equal');
patchedCanPlayType = video.canPlayType;
unpatchedCanPlayType = vjs.Html5.unpatchCanPlayType();
if (canPlayType) {
strictEqual(canPlayType, vjs.TEST_VID.constructor.prototype.canPlayType, 'original canPlayType and unpatched canPlayType should be equal');
strictEqual(patchedCanPlayType, unpatchedCanPlayType, 'patched canPlayType and function returned from unpatch are equal');
}
vjs.ANDROID_VERSION = oldAV;
vjs.Html5.unpatchCanPlayType();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment