shaka-player icon indicating copy to clipboard operation
shaka-player copied to clipboard

HLS AES-128 streams fail to play in MS Edge and when casting

Open multiplexer2 opened this issue 2 years ago • 6 comments

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

What version of Shaka Player are you using? 4.2 nightly

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Have not tried

Are you using the demo app or your own custom app? The Shaka demo app

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using? Microsoft Edge Chromecast from Google Chrome on Windows and Ubuntu

For embedded devices (smart TVs, etc.), what model and firmware version are you using? N/A

What are the manifest and license server URIs? I've been testing with "Art of Motion (HLS, TS, AES-128)" on the Shaka demo page

What configuration are you using? What is the output of player.getConfiguration()? The config is as configured on the demo page

What did you do? Test 1: Navigate to the stream in MS Edge and start playback Test 2: Navigate to the stream in Chrome and start casting

What did you expect to happen? The video to play without issues

What actually happened? In both cases, the video starts playing but after a couple of seconds playback stops with the following error:

Failed to set the 'timestampOffset' property on 'SourceBuffer': The timestamp offset may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.
    at shaka.media.MediaSourceEngine.appendBuffer (https://nightly-dot-shaka-player-demo.appspot.com/lib/media/media_source_engine.js:630:38)
    at async shaka.media.StreamingEngine.append_ (https://nightly-dot-shaka-player-demo.appspot.com/lib/media/streaming_engine.js:1646:5)
    at async shaka.media.StreamingEngine.fetchAndAppend_ (https://nightly-dot-shaka-player-demo.appspot.com/lib/media/streaming_engine.js:1301:9)

multiplexer2 avatar Aug 25 '22 12:08 multiplexer2

image https://shaka-player-demo.appspot.com/demo/#audiolang=es;textlang=es;uilang=es;asset=https://storage.googleapis.com/shaka-demo-assets/sintel-ts-aes-key-rotation/master.m3u8;panel=ALL_CONTENT;build=uncompiled

I was able to reproduce it in Edge. There must be some bug in the AES-128 implementation. @theodab you have implemented it, can you take a look at it?

avelad avatar Aug 25 '22 18:08 avelad

MS Edge has native transmuxing of mpeg-2-ts chunks of hls streams. So to counter it. First of all, make sure you have this included


<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mux.js"></script>

in the head of your app or project.

...

And also make sure you have


player.configure("streaming.forceTransmuxTS", true);

inside your init function. I.e.


async function init() { player.configure("streaming.forceTransmuxTS", true); }

Make sure to report this error to MS so you don't have to include this all in future.

shrkwt avatar Aug 29 '22 00:08 shrkwt

This was how I fixed it as I also use MS edge.

https://www.speedynet.eu.org/shaka?link=<YOUR_MANIFEST_URL>

This is a quick way of testing HLS streams on Edge with Shaka player.

shrkwt avatar Aug 29 '22 00:08 shrkwt

We just pushed Shaka 4.2.0 to production and started seeing this issue in MS Edge.

Failed to set the 'timestampOffset' property on 'SourceBuffer': The timestamp offset may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'

We'll test the player.configure("streaming.forceTransmuxTS", true); fix.

martinstark avatar Aug 29 '22 08:08 martinstark

I would guess that errors relating to timestampOffset may not have anything to do with encryption.

I'm confused by some of the posts. The OP says the issue starts when casting, but others are suggesting fixes that relate to Edge playback rather than Chromecast playback.

Does the issue occur only when casting? Or does the issue occur when playing directly in Edge?

Does the issue occur when casting from other browsers, such as Chrome?

joeyparrish avatar Aug 29 '22 18:08 joeyparrish

Does the issue occur only when casting? Or does the issue occur when playing directly in Edge?

Both. The problem occurs with direct playback from Edge - and also when initiating a cast session from any browser, including Edge. When I add the forceTransmuxTS workaround to the player setup in Edge, direct playback works fine. But when attempting to cast the player throws that same error message:


CastSender: onSessionInitiated CastSender: connection status true Starting unload... CastSender: connection status true Error code 11 object Error: Failed to set the 'timestampOffset' property on 'SourceBuffer': The timestamp offset may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.

Does the issue occur when casting from other browsers, such as Chrome?

Yes.

multiplexer2 avatar Aug 30 '22 07:08 multiplexer2

@theodab can you review this issue? Thanks!

avelad avatar Oct 06 '22 09:10 avelad

I tried this out in MS Edge and didn't see the error. I un-applied #4543 (which looks like it is describing the same issue) and tried again and did see the error, so I think this is fixed now. If you see that error again, you can re-open this.

theodab avatar Oct 11 '22 11:10 theodab