|
|
|
|
@ -5,6 +5,8 @@ import android.text.TextUtils; |
|
|
|
|
import androidx.media3.common.C; |
|
|
|
|
import androidx.media3.common.MediaItem; |
|
|
|
|
|
|
|
|
|
import com.github.catvod.utils.Json; |
|
|
|
|
import com.google.gson.JsonElement; |
|
|
|
|
import com.google.gson.annotations.SerializedName; |
|
|
|
|
|
|
|
|
|
import java.util.UUID; |
|
|
|
|
@ -15,6 +17,8 @@ public class Drm { |
|
|
|
|
private String key; |
|
|
|
|
@SerializedName("type") |
|
|
|
|
private String type; |
|
|
|
|
@SerializedName("header") |
|
|
|
|
private JsonElement header; |
|
|
|
|
|
|
|
|
|
public static Drm create(String key, String type) { |
|
|
|
|
return new Drm(key, type); |
|
|
|
|
@ -33,6 +37,10 @@ public class Drm { |
|
|
|
|
return TextUtils.isEmpty(type) ? "" : type; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JsonElement getHeader() { |
|
|
|
|
return header; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public UUID getUUID() { |
|
|
|
|
if (getType().contains("playready")) return C.PLAYREADY_UUID; |
|
|
|
|
if (getType().contains("widevine")) return C.WIDEVINE_UUID; |
|
|
|
|
@ -41,6 +49,6 @@ public class Drm { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public MediaItem.DrmConfiguration get() { |
|
|
|
|
return new MediaItem.DrmConfiguration.Builder(getUUID()).setLicenseUri(getKey()).setMultiSession(!getType().contains("clearkey")).build(); |
|
|
|
|
return new MediaItem.DrmConfiguration.Builder(getUUID()).setLicenseUri(getKey()).setLicenseRequestHeaders(Json.toMap(getHeader())).setMultiSession(!getType().contains("clearkey")).build(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|