Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monkeypatch canPlayType on Android 4.0+ for HLS #1084

Merged
merged 14 commits into from
Mar 26, 2014
Merged
Prev Previous commit
Always unpatch canPlayType.
Fix up tests to not ignore some if canPlayType is not available since
unpatch is no longer broken.
  • Loading branch information
gkatsev committed Mar 26, 2014
commit e39557e79033574a4b5b0c6c3407c746a7df42a6
8 changes: 3 additions & 5 deletions src/js/media/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,9 @@ vjs.Html5.canControlVolume = function(){

vjs.Html5.unpatchCanPlayType = function() {
var r = vjs.TEST_VID.constructor.prototype.canPlayType;
if (canPlayType) {
vjs.TEST_VID.constructor.prototype.canPlayType = canPlayType;
canPlayType = null;
return r;
}
vjs.TEST_VID.constructor.prototype.canPlayType = canPlayType;
canPlayType = null;
return r;
};

// by default, patch the video element
Expand Down
6 changes: 2 additions & 4 deletions test/unit/media.html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ test('patchCanPlayType patches canplaytype with our function, conditionally', fu
patchedCanPlayType = video.canPlayType;
unpatchedCanPlayType = vjs.Html5.unpatchCanPlayType();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unpatchedCanPlayType isn't currently used


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');
}
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();
Expand Down