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

DRM Playback in safari : Error Code: MEDIA_ERR_DECODE #105

Open
alenzalex opened this issue Jun 5, 2020 · 2 comments
Open

DRM Playback in safari : Error Code: MEDIA_ERR_DECODE #105

alenzalex opened this issue Jun 5, 2020 · 2 comments

Comments

@alenzalex
Copy link

Safari Version : 13.1

When I play DRM content in safari, I get error as
KeySession error: code 6, systemCode 4294924646
with error code as : (CODE:5 MEDIA_ERR_ENCRYPTED)

Then, it displays error as
The media playback was aborted due to a corruption problem or because the media used features your browser did not support
with error code : (CODE:3 MEDIA_ERR_DECODE)

@alenzalex
Copy link
Author

getCertificate() -----> executed and return success
getContentId() -----> executed and return success
getLicense() -----> never enters this function

@alenzalex
Copy link
Author

Attaching code snippet that I have tried :

player.ready(function () {
player.eme();
var emeOptions = {}

player.src({
    src: videSourceUrl,
    type: 'application/x-mpegURL',
    keySystems: {
	     'com.apple.fps.1_0': {
  	      getCertificate: function(emeOptions, callback) {
    		   let reqBody = { merchantId: 'myapp_testing' };
                   videojs.xhr({
                      uri: 'http://localhost:3080/getCertificate',
                      method: 'POST',
                      responseType: 'arraybuffer',
                      body: JSON.stringify(reqBody),
                  headers: {
              	     'Content-type': 'application/json'
                   }
          	}, function (err, response, responseBody) {
            	if (err) {
                console.log('error in getCertificate')
              		callback(err);
              		return;
            	}
              console.log('success in getting Certificate')
              callback(null, responseBody);
            	//var lab = decodeB64ToUint8Array(responseBody.license);
            	//callback(null, lab);
          	});
  		},

  		getContentId: function(emeOptions, initData) {
    	          console.log('Fairplay: getContentId')
                      const hostname = getHostnameFromUri(Utf8ArrayToStr(initData))
                      console.log('Fairplay: getContentId acquired')
                      return hostname
  		},

  		getLicense: function(emeOptions, contentId, keyMessage, callback) {
                    console.log('Inside getLicense:to proxy')
                    let reqBody = {
                            accountId: 'accountId',
                            videoId: 'videoId',
                            merchantId: 'myapp_testing'
                         };
                 var spcMessage = encodeURIComponent(encodeToB64Uint8Array(keyMessage));
                 var keySystem = emeOptions.keySystems['com.apple.fps.1_0'];
                 var options = keySystem.vendor.options;
    	     videojs.xhr({
            	       uri: 'http://localhost:3080/getLicense',
            	       method: 'POST',
            	       responseType: 'text',
            	       body: "spc=" + spcMessage + "&" + contentId,
            	       headers: {
              	          'x-dt-auth-token': options.authToken,
                              'x-dt-custom-data': normalizeCustomData(options),
                              'Content-type': 'application/x-www-form-urlencoded' 
                   }
          	}, function (err, response, responseBody) {
            	if (err) {
              		callback(err);
              		return;
            	} else {
            		callback(null, new Uint8Array(responseBody));
            	}
          	});
  			}
		}
	}
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant