Widevine encrypted videos in Azure do not expire - azure

I am trying to enable my Azure-hosted video for offline viewing in Chrome with a "rental period" so that it expires after a few days. I started with the OfflinePlayReadyAndWidevine java example project. I updated this method to specify 30 seconds for all three durations.
policyOverrides.setRentalDurationSeconds(30);
policyOverrides.setPlaybackDurationSeconds(30);
policyOverrides.setLicenseDurationSeconds(30);
That seemed to work. Looking at the Asset Information inside Azure Media Services Explorer, I see in the Content Protection tab these 30 second durations show up:
"properties.options": [
{
"policyOptionId": "1d9620f2-bc02-4ddc-a64f-b25e5f02b6e5",
"name": null,
"configuration": {
"widevineTemplate": "{\"AllowedTrackTypes\":\"SD_HD\",\"ContentKeySpecs\":[{\"TrackType\":\"SD\",\"SecurityLevel\":1,\"RequiredOutputProtection\":{\"HDCP\":\"HDCP_NONE\"}}],\"PolicyOverrides\":{\"CanPlay\":true,\"CanPersist\":true,\"CanRenew\":false,\"RentalDurationSeconds\":30,\"PlaybackDurationSeconds\":30,\"LicenseDurationSeconds\":30}}"
},
"restriction": {}
}
],
But it doesn't seem to take effect. In Chrome on Windows, I add my URL to the Shaka player with its Custom Content section, clicked the download button, unplugged the internet, and I am able to play the video over and over. It does not seem to expire. I also do not experience expiration in the Azure media player, although I'm focused on getting Shaka to work first because of its offline support.
If someone has tested this to work before, I'd be very interested to see how!

In your Widevine template, the 3 attribute names:
RentalDurationSeconds
PlaybackDurationSeconds
LicenseDurationSeconds
look different from the corresponding 3 attribute names in Widevine proxy spec or in Azure Media Services doc on Widevine template (https://learn.microsoft.com/en-us/azure/media-services/previous/media-services-widevine-license-template-overview)
They should be, respectively
rental_duration_seconds
playback_duration_seconds
license_duration_seconds
This way it would be consistent with Widevine proxy doc or AMS doc above.
For the time being, could you set the Widevine template as a JSON string instead of thru property setters?

Related

How to track Google chrome extension (UA-XXXX) with GA4 ID

I have a new Google Chrome extension, that i want to track using the built-in Google analytics tracking. My Chrome extension dashboard has a field for "Google analytics ID", (UA-XXXX) however I can only create new Google Analytics properties using the new Google Analytics 4 (GA4) type, which uses a different Google analytics ID format (G-XXXX)
What do i put into the Google Chrome extension "Google analyics ID" fiekd (UA-XXXXXX) to track it with my GA4 property?
You cant. If the tracker was designed to work with UA analytics you need a UA-XXXX property id to track data with it.
You need to find one that is designed to work with GA4 and accepts a G-XXXX code.
it is still possible to create 2 properties (for old analytics and for GA4) but 'google analytics tracking ID' for GA4 contains only digits, no UA at all. in the question G-XXXX format is mentioned, this format corresponds to 'measurement ID' not to 'google analytics tracking ID'. and I believe it's not the same at all. so for GA4 there are 2 IDs (both without UA) and it's still not clear which one we have to put in "Google analytics ID"...

Azure Media Service - No compatible source found for this media

I'm trying to use Azure Media Services to live stream an IP cam through OBS.
So I'll try to describe my setup.
I added a new Media Service via the Azure Portal.
It has it's own storage account.
Still in the portal in that Media Service I choose 'Browse Channels'.
Here I create a new channel, I tried Live Encoding and Pass Through. I get the same result with both.
So the channel is created, I wait until it is started and I open that blade of the channel.
I copy the Primary Injest endpoint and copy that in the settings of OBS, as a stream key I use the name of the channel/account (I picked the same name for both) and start streaming from OBS.
I then click more in the top right of the blade and pick 'Watch preview'.
A new blade opens with a player with an error in it.
When I copy the playback url and open it in VLC it plays correctly for roughly 30 seconds.
Now if I add a new Program back in the Channel Blade it adds it, and starts it up. When started I open the Program Blade and get a loading screen which doesn't end. Looking in the network tab of the developer tools, no errors are present and no open requests.
When I refresh the page I sometimes get the following:
I don't like the red icon but okay. I click the locator and get this:
Clicking the blue box opens a new Blade with a generic error:
With the following error in the dev console:
When trying to open the url from the Locator Blade or the Program Blade in VLC it doesn't open.
I once had the problems I'm having now, but a couple of days later they were resolved without action from my side.
Now I'm having the same problems again.
I tried recreating everything from scratch, but I get the same errors.
From the comment, it seems that all the problems were solved now.
Here is just my experience which may answer your question. I used to have the same issue, and finally I found that I need to start the stream endpoint. At least one stream endpoint needs to be started before we can provide a video streaming service.
If you want to preview the live stream, you need to start the stream endpoint too, as all the stream content will be delivered from stream endpoints.
Update:
You can start a stream endpoint on the portal:
Navigate to your azure media service resource.
Click the "Streaming endpoints" label.
Then you will see all the streaming endpoints you have.
Choose one endpoint, and you can start or stop it in the showing page.

Chromium - "Failed because the user didn't interact with the document first" in chrome?

Ok, autoplay on visit used to work on our site. However now, we are getting:
play() failed because the user didn't interact with the document first
How come autoplay works on Youtube though? For instance on open video in new tab.
Using HLS.js it no longer work.
What is Youtube doing that we could do here?
The latest version of chrome creates a per domain “score” if a user has interacted with media 20 times on a domain, it is allowed to auto play. If the interaction score is lower, it can't. Chrome has a post about this on the developer blog.

Azure media player not playing uploaded video on MS Azure Media Services

I'm trying to use Azure Media Services. For demo purpose I've uploaded a video directly on the portal then clicked to encode this uploaded video in 'H264 Smooth Streaming 720p' preset.
This scheduled a encoding job which generated another (off-course larger) file which I published to get the manifest file URL.
I can play this video on the portal itself but when I use the given URL I get the following error:
A network error caused the video download to fail part-way. Please check your network connection or try again later. (0x20200000)
I'm taking help from this Channel9 video.
Please help me on this.
Please add &format=smooth to your URL and it should work!
http://amsplayer.azurewebsites.net/azuremediaplayer.html?url=http%3A%2F%2Fmspocforknorish.streaming.mediaservices.windows.net%2F72496130-cb2d-455e-9ccd-420fcb506f1d%2FBigBuckBunny.ism%2FManifest&format=smooth
Otherwise, on the page check "Advanced Options" checkbox and select Smooth from the Format dropdown and click on "Update" button.
When you paste your URL into the URL input, delete the existing sample URL that is already there. The existing URL looks like placeholder text but it is not. I fell into that trap too.
Here is a screenshot of your video playing and here is the URL of it playing.

Territory restrictions and linked tracks in Spotify

I am building an app that needs to know if a track is playable in the user's region.
It's easy to check the basic territorial restrictions of a track using the Metadata API. However, I am encountering tracks that the Metadata API says are out of my region, but are auto-linked to versions of the same track that aren't region locked. ie. Metadata says I can't play a track, but as far as the user is concerned, Spotify can play that track.
Here's an example:
'Sweet Unrest' by Apparat # spotify:track:4H4h3ulzjGVox14GHiCEoo
I am in the UK (territory code GB)
The lookup link is http://ws.spotify.com/lookup/1/.json?uri=spotify:track:4H4h3ulzjGVox14GHiCEoo
There is no GB code in the resulting territories string, so in theory, I should not be able to play the track. However, in the main Spotify player, I can see that it is auto linked to spotify:track:11S6TQybYumAnNApugZWSJ which is playable in my region. If I paste the supposedly unplayable track's URI into the top left Spotify search box, it plays.
Is there an API based way to check for tracks like this?
You can detect whether a track is playable or not using an undocumented property of each track: data.availableForPlayback
Track.fromURI("spotify:track:XXX", function(track) {
alert(track.data.availableForPlayback);
});
If you run the code above, you should get a True/False that does what you're after.
Unfortunately not, not at this time. The linking is actually done by the client itself rather than any of our backend services, so none of our APIs have this information.

Resources