diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index c59f6e9668c5..27d13e53aded 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3084,7 +3084,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
mDecoder->SetFragmentEndTime(mFragmentEnd);
}
if (mIsEncrypted) {
- if (!mMediaSource) {
+ if (!mMediaSource && Preferences::GetBool("media.eme.mse-only", true)) {
DecodeError();
return;
}