gpt4 book ai didi

javascript - 带有 DRM url 的 Google cast v3 CAF Receiver 应用程序

转载 作者:行者123 更新时间:2023-11-30 06:12:39 27 4
gpt4 key购买 nike

我正在尝试使用 v3 CAF 接收器应用程序使用 DRM 从我的 IOS 应用程序转换视频。如果我使用基本的 v3 CAF 接收器应用程序(默认接收器)它工作正常,但是当我使用 DRM url(dash/.mpd 和 licenseUrl ) 时它会抛出下面错误错误

[ 20.844s] [Error] [INFO] {"type":"LOAD_CANCELLED","requestId":0}

请看下面的代码。

const playerManager = context.getPlayerManager();
const playbackConfig = new cast.framework.PlaybackConfig();
/** Debug Logger **/
const castDebugLogger = cast.debug.CastDebugLogger.getInstance();

var manifestUri = 'https://example.domain.video/prod/drm/1/7e942940-d705-4417-b552-796e8fd25460/Media_1_20_d2aaec7102dc42c09dd54e4f00cbea412019062801270383196000/dash/manifest.mpd';
var licenseServer = 'https://wv.example.domain.com/hms/wv/rights/?ExpressPlayToken=BQALuGDeKZcAJDE2YzAwYTRkLTYwZWYtNGJiZC1hZmEzLTdhMmZhYTY2NzM5OQAAAHCZzHVjRyfs3AEgxFuwPvZsrqMndjiBPzLQ5_VUx6rJOEDD5noQmXJoVP-Va1gQzxfp9eHux15_pEr6g0RxXNZIjlsN6b7SIfpHPyS9iuPQqgvEgq5I_tV9k1lhQvKuqgpBN0Z5BtxCLwHc8xrnLbuUK6fiThcLMR4He_x38reAsumjFYg';

// setting manually licenseUrl from here
playbackConfig.licenseUrl = licenseServer;

playbackConfig.manifestRequestHandler = requestInfo => {
requestInfo.withCredentials = true;
};

playbackConfig.licenseRequestHandler = requestInfo => {
requestInfo.withCredentials = true;
requestInfo.headers = {
// 'Content-type':'application/dash+xml', // trying this also
'Content-type':'application/octet-stream'
}
playbackConfig.licenseUrl = requestInfo.media.customData.licenseUrl;
return playbackConfig;
};

// MessageInterceptor
playerManager.setMessageInterceptor(
cast.framework.messages.MessageType.LOAD,
request => {
const error = new cast.framework.messages.ErrorData(cast.framework.messages.ErrorType.LOAD_CANCELLED);
castDebugLogger.info('Error', error);
if (!request.media) {
error.reason = cast.framework.messages.ErrorReason.INVALID_PARAM;
castDebugLogger.info('reason', error.reason);
return error;
}
if (request.media && request.media.entity) {
request.media.contentId = request.media.entity;
}

return new Promise((resolve, reject) => {
if (!request.media) {
castDebugLogger.error('MyAPP.LOG', 'Content not found');
reject();
} else {

// I have passed manually data (license Url and content Id etc.) from here for testing purpose
const item = new cast.framework.messages.QueueItem();
item.media = new cast.framework.messages.MediaInformation();
item.media.contentId = manifestUri;
item.media.streamType = cast.framework.messages.StreamType.BUFFERED;

// Trying all options of contentType

item.media.contentType = "application/octet-stream";
//request.media.contentType = 'application/x-mpegurl';
//item.media.contentType = "video/mp4";
//request.media.contentType = 'video/mp4';
//request.media.contentType = 'application/dash+xml';
item.media.metadata = new cast.framework.messages.MovieMediaMetadata();
item.media.metadata.title = "Example title";
item.media.metadata.subtitle = "Example subtitle ";
item.media.metadata.images = [new cast.framework.messages.Image("https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg")];
request.media = item.media;
playbackConfig.protectionSystem = cast.framework.ContentProtection.WIDEVINE;

resolve(request);
}
});
});

// start
context.start({
playbackConfig: playbackConfig,
touchScreenOptimizedApp: true
});

LA_URL.mpd url 与另一个在线 shaka 播放器一起工作正常。

最佳答案

当为编码的破折号流发出加载请求时,您是否检查了远程网络检查器是否将网络请求发送给了许可方?这很可能有助于找到问题所在。

可能您必须向 licenseRequestHandler 添加一些智能才能添加某种 token 。或者可能存在 CORS 问题。

注意:在将一些代码发布到 stackoverflow 之前,可能需要对其进行一些清理:删除无效代码、删除令人困惑的注释代码、提供适当的缩进。您正在浪费每个人阅读您的代码并尝试处理您与世界分享的内容的大脑周期!

关于javascript - 带有 DRM url 的 Google cast v3 CAF Receiver 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57972978/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com