The source for the page can be found on GitHub.
This is the problematic setup that does not work on Desktop Safari. We are creating
a media source here and listen to encrypted
events with
sinf
init data.
Segments are pushed in the following order:
encrypted
event and
we load the HD key.
encrypted
event and
we load the SD key.
Keys are loaded successfully for both SD and
HD renditions and playback starts and plays until the segment transition
from HD to SD at 4 seconds. We do receive a resize
event
but the video freezes. There is no indication of any error and even
the timeupdate
events keep on coming in.
Note that seems is working fine on iOS but does not work as expected on Desktop Safari.
encrypted
event. Works!
This is the base implementation that uses AVPlayer and the video element
directly and loads an HLS playlist with skd
init data.
We are using a bit of scaling and sizing CSS here to make the video element appear large enough to AVPlayer to decide to scale up to the HD rendition.
Watch the even log on screen. When the resize event occurs that indicates that the video element resized to 1080p, the player successfully switched from SD to HD and handled the license transition well.
This example uses our single key test content and switches between HD and SD renditions.
This is the same setup and uses the same source and rendition as with the multi key example, but we play only the SD or HD renditions respectively to make sure that each rendition plays standalone.
Note that we are not pushing the full content but only the first 4 segments so video playback will stall at around 16 seconds.