Drm video stops after 2 minutes of playing - drm

Cobalt 19.lts.2.188191. I am used default implementation of Widevine L3. After 2-3 minutes the DRM video playing stops. This issue manifests itself in the following videos:
https://www.youtube.com/tv#/watch?v=jIStmjA2M24
https://www.youtube.com/tv#/watch?v=g5jbF_H72NA
https://www.youtube.com/tv#/watch?v=mTaP9_cumoE
These videos were provided to us by a YouTube account manager.
The log after 2 minutes of playing:
...
[ERROR:core/src/cdm_engine.cpp(1406):Decrypt] CdmEngine::Decrypt: session not found: Empty session ID
[ERROR:cdm/src/cdm.cpp(999):decrypt] Key not available.
[ERROR:core/src/cdm_engine.cpp(1406):Decrypt] CdmEngine::Decrypt: session not found: Empty session ID
[ERROR:cdm/src/cdm.cpp(999):decrypt] Key not available.
...

Do you support DRM key rotation? Those videos rotate the keys every two minutes. Please take a look at YouTube's EME section of Technical Requirements.

Related

Fetch Instagram live stream RTMP URL and Key

There are apps such as yellow duck that will fetch the RTMP URL and key for you. These can then be used with OBS, or any other streaming software. The feature I am building requires replicating what Instagram does, and extracting the RTMP details from Instagram for a user.
I have tried using Charles proxy to determine how Yellow duck works, but my skills there are limited, and have yielded no results.
I know that there are no public APIs available for this, and that this is probably a violation of their ToS.

Widevine encrypted videos in Azure do not expire

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?

How to know when the user changes the song with the Spotify API

I need to know when the user changes the song that is "currently playing".
Currently, I'm using https://api.spotify.com/v1/me/player/currently-playing to get the information about the song that is "currently playing". But, I need to know when it changes to the next one (not only because the song finished, but also when the user press NEXT SONG button).
My current workaround is to call the https://api.spotify.com/v1/me/player/currently-playing endpoint every second, but I'll be out of the rate limit if I do it very often.
You are doing it right. You need to poll the https://api.spotify.com/v1/me/player/currently-playing endpoint to detect changes in the playback state.
In some scenarios it can be suitable to use Spotify's web playback SDK, which exposes a player_state_changed event. For this to work the user needs to have a premium account and the playback needs to happen on the device created by the SDK.

Spotify API player update event

Basically I want to display the current track on a website.
I already searched quite a bit for a possibility to get notified when player state (play/pause, track, current position) changes.
My question:
Is it possible to get notified (socket, hook call) or is the only possibility I have to call the Web API like every second and fetch the state?
I fear that I'm running into rate limits when multiple users connect their accounts and display the current track.
Nope, there's still no way to do that. To achieve what you'd like, you need to pool the Spotify API continuously.
You can however use the Spotify SDK that you can pass a function to be executed on playback state change. The SDK is incompatible with a few platforms (see supported browsers), but for those you could catch the SDK initialization error and then switch to continuous polling via the API. You will have a lot fewer requests then.
A second option would be to only update the currently playing song after the last song should have ended. When getting the playback state for the currently playing song, you could use the field duration_ms and progress_ms to calculate the remaining time of the song. Then schedule another API requests for when the song should have ended and you're good. Whether that's a good strategy for your use case or not depends on the type of playback and how often the playback changes in your app.
I hope I could help!
As of now, it seems to be possible to receive player state events with a listener:
https://developer.spotify.com/documentation/web-playback-sdk/guide/#playback-information-display
I haven't tested the Web version, I'm currently using the analogous Android APIs, and Android's seems to work for play/pause change and track change (but not for position change)

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