Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.21k stars 523 forks source link

Getting 404 error playing clearkey hls with token in the Video player #5613

Open sturlath opened 2 weeks ago

sturlath commented 2 weeks ago

First some context Microsoft is discontinuing Azure Media Services and the Azure Media Player and their first choose of partners to move to is mk.io that offers this mkplayer

My issue I have been trying to get this to work with the Blazorise Video player without any luck

I just get 404 error for my hls+clearkey+token stream (that works in the mk.io test player) image

I have tried this here (and many other things)

<Video Source="@(HlsUrl)" StreamingLibrary="StreamingLibrary.Hls" ProtectionType="VideoProtectionType.None" ProtectionHttpRequestHeaders="@Token" AutoPlay="true" /> 
<Video Source="@(HlsUrl)" StreamingLibrary="StreamingLibrary.Hls" ProtectionType="VideoProtectionType.None" ProtectionHttpRequestHeaders='@($"Authorization: Bearer={Token}")' AutoPlay="true" />

I have also tried it with ProtectionServerUrl="HLS_AES" with the same result

<Video Source="@(HlsUrl)" StreamingLibrary="StreamingLibrary.Hls" ProtectionServerUrl="HLS_AES" ProtectionType="VideoProtectionType.None" ProtectionHttpRequestHeaders="@Token" AutoPlay="true" /> 
<Video Source="@(HlsUrl)" ProtectionServerUrl="HLS_AES" StreamingLibrary="StreamingLibrary.Hls" ProtectionType="VideoProtectionType.None" ProtectionHttpRequestHeaders='@($"Authorization: Bearer={Token}")' AutoPlay="true" />

What is basically needed for the setup of the player is the following

const sourceConfig = {
    hls: streamingUrl, 
    drm: {
        clearkey: {
            // depending if licenceType is hls or dash
            // if hls then LA_URL == HLS_AES
            // if dash then LA_URL == https://ottapp-appgw-amp.prodc.mkio.tv3cloud.com/drm/clear-key?ownerUid=azuki
            LA_URL: "HLS_AES",
            headers: {"Authorization": "Bearer=" + token} // token format
        }
    }
};

Using my url and token with HLS_AES works fine if I just use it in the mk.io test page (need to be logged in) so I know that I have working data but must be using them incorrectly Screenshot 2024-07-08 100202

Any idea what I´m doing wrong or could try out?

stsrki commented 2 weeks ago

I'm currently experimenting with the new Video player library, which will ultimately replace the original plyr.js. So far, it is promising, although not all features are supported yet, or I haven't found an alternative.

It would be great if you could try the branch on your side and see how it works in your case.

sturlath commented 2 weeks ago

I can try it out np (in the next few days since I´m on/off vacation). Just tell me what branch to try.

stsrki commented 2 weeks ago

You can see the branch name in the PR. But, it is dev-video-update-to-vidstack

stsrki commented 1 week ago

Hello @sturlath

We are just a few days until the 1.6 release, so would it be possible for you to test our new Video player implementation? I have made many changes and also included new HLS DRM protection. It would help us a lot to have some feedback. Thanks.

Sturla76 commented 1 week ago

I was going to try it out but hit some other issues and then I went on holiday 🙈 Ill be back in 5 days and could try it out then if its not too late?

sturlath commented 5 days ago

@stsrki I came home early and am trying to figure this out but I´m getting this

image

<Video @ref="@videoRef" 
    Source="@videoSource" 
    ProtectionType="VideoProtectionType.None" 
    StreamingLibrary="StreamingLibrary.Hls" 
    ProtectionServerCertificateUrl="HLS_AES"
ProtectionHttpRequestHeaders="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6bWF4dXNlcyI6IjUiLCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiJiMjE2NDA3OC0xMDExLTQ3NDYtYjQxNS02NWU5Y2M5Y2I3OGQiLCJuYmYiOjE3MjE3NDAyOTMsImV4cCI6MTcyMTc0MDQ3MywiaXNzIjoiaUJlaW5uaUlzc3VlciIsImF1ZCI6ImlCZWlubmlBdWRpZW5jZSJ9.Z6ztxKbe2yKpbe1YDgI_DUBSHh2ooCroBQbEeamDqi0" 
CurrentTime="@currentTime" 
DefaultQuality="@defaultQuality" />

VideoSource videoSource = new VideoSource()
{
    Medias = new ValueEqualityList<VideoMedia>
    {
        new VideoMedia("https://uksouth.av.mk.io/default-streamworks-dev/b2164078-1011-4746-b415-65e9cc9cb78d/index.qfm/manifest(format=m3u8-cmaf,encryption=cbc)", "video/mp4", 1280, 720),
    }
};

I´m not sure how to configure it to work...

I also tried

StreamingLibrary="StreamingLibrary.Dash"
ProtectionServerCertificateUrl="https://ottapp-appgw-amp.prodc.mkio.tv3cloud.com/drm/clear-key?ownerUid=azuki"

🤷‍♂️

Ping me if you want to have a live open stream to test with and I´ll send it to your yahoo email if that hasn´t changed.

stsrki commented 5 days ago

I can ping you later when I also get home.

In the meantime can you changing the media type to something else? It can help the player to hint the right video format.

sturlath commented 5 days ago

I tried all the types but it didn´t change anything.

    private static Dictionary<string, string> VideoTypes = new Dictionary<string, string>( StringComparer.OrdinalIgnoreCase )
    {
        { "mp4", "video/mp4" },
        { "webm", "video/webm" },
        { "3gp", "video/3gp" },
        { "ogg", "video/ogg" },
        { "avi", "video/avi" },
        { "mpeg", "video/mpeg" }
    };

But isn´t "clearkey" missing in this all?

Because this is the mk.io test player and it also has none

HLS image

DASH With https://ottapp-appgw-amp.prodc.mkio.tv3cloud.com/drm/clear-key?ownerUid=azuki image

stsrki commented 5 days ago

@Sturla76 sent you an email.