Skip to content

"Media failed to decode error" after a few playbacks on macOS #7629

@lepinese

Description

@lepinese

Have you read the FAQ and checked for duplicate open issues?
Yes

If the problem is related to FairPlay, have you read the tutorial?

Yes

What version of Shaka Player are you using?

4.9.8

Are you using the demo app or your own custom app?
Custom app

If custom app, can you reproduce the issue using our demo app?
Haven't been able to make the custom demo app work at all, the License call fails with a HTTP Status 412 – Precondition Failed.
But the Big Buck Bunny (FairPlay) demo works fine.

What browser and OS are you using?
Safari : 17.2.1
macOS : Sonoma 14.2.1

What are the manifest and license server URIs?

We are using DRMToday

What configuration are you using? What is the output of player.getNonDefaultConfiguration()?

"{
  \"drm\": {
    \"retryParameters\": {
      \"baseDelay\": 100
    },
    \"servers\": {
      \"com.apple.fps\": \"https://lic.drmtoday.com/license-server-fairplay/\"
    },
    \"advanced\": {
      \"com.apple.fps\": {
        \"distinctiveIdentifierRequired\": false,
        \"persistentStateRequired\": false,
        \"videoRobustness\": \"\",
        \"audioRobustness\": \"\",
        \"sessionType\": \"\",
        \"serverCertificate\": {
           ** The certificate **
        },
        \"serverCertificateUri\": \"\",
        \"individualizationServer\": \"\"
      }
    }
  },
  \"manifest\": {
    \"retryParameters\": {
      \"baseDelay\": 100
    },
    \"availabilityWindowOverride\": null,
    \"dash\": {
      \"autoCorrectDrift\": false,
      \"ignoreSuggestedPresentationDelay\": true
    }
  },
  \"streaming\": {
    \"retryParameters\": {
      \"baseDelay\": 100
    },
    \"rebufferingGoal\": 0.01,
    \"inaccurateManifestTolerance\": 0,
    \"lowLatencyMode\": true,
    \"updateIntervalSeconds\": 0.1,
    \"maxDisabledTime\": 1,
    \"segmentPrefetchLimit\": 2
  },
  \"mediaSource\": {},
  \"offline\": {}
}"

What did you do?

The first few playbacks of the media work normally but then at some point (could be 1, 10 or more playbacks) we keep getting the "Media failed to decode" error and it stops working.

I found this issue which looks similar but was closed to inactivity : #4852

Just like this issue, when restarting Safari it works again.

When it fails, our license calls are still working normally. When looking at the debug console there doesn't seem to be any relevant information about what's going wrong.

Screenshot 2024-11-19 at 11 50 39

Here's a bit of code :

this.player.getNetworkingEngine().registerRequestFilter(function(type, request) {
    if (type === shaka.net.NetworkingEngine.RequestType.LICENSE) {
        request.headers['X-Dt-Auth-Token'] = fairplayAuthToken;
    }
});
this.player.getNetworkingEngine().registerResponseFilter(function(type, response) {
    if (type === shaka.net.NetworkingEngine.RequestType.LICENSE) {
        const responseText = shaka.util.StringUtils.fromUTF8(response.data);
        response.data = shaka.util.Uint8ArrayUtils.fromBase64(responseText).buffer;
    }
});
this.player.configure({
    drm: servers: {
        'com.apple.fps': fairplayLicenseUrl)
    },
    advanced: {
        'com.apple.fps': {
            serverCertificate: new Uint8Array(fairplayCertificate)
        }
    manifest: {
        hls: {
            allowLowLatencyByteRangeOptimization: true
        }
    }
});

What did you expect to happen?
The media to work all the time

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: FairPlayThe issue involves the FairPlay DRMcomponent: HLSThe issue involves Apple's HLS manifest formatstatus: archivedArchived and locked; will not be updatedtype: bugSomething isn't working correctly

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions