Приложение приемника Cast Application Framework не работает на внешнем устройстве приведения 2-го поколения - PullRequest
1 голос
/ 17 октября 2019

Я пытаюсь разработать приложение для приемника CAF v3, и оно работает со встроенными и настраиваемыми устройствами для литья устройств, но не работает с внешними устройствами для литья.

Внешние устройства для литья NC2-A65 выбрасывает PIPELINE_INITIALIZATION_ERROR илиVIDEO_ERROR с shaka error code 3016

После отладки выполняется наблюдение drm Лицензия Url не вызывается, когда useLegacyDashSupport равен true

Любая помощь приветствуется

Вот код,

<script>
    const context = cast.framework.CastReceiverContext.getInstance();
    context.setLoggerLevel(cast.framework.LoggerLevel.DEBUG);
    const options = new cast.framework.CastReceiverOptions();
    const castDebugLogger = cast.debug.CastDebugLogger.getInstance();
    const playerManager = context.getPlayerManager();
    const playbackConfig = (Object.assign(new cast.framework.PlaybackConfig(), playerManager.getPlaybackConfig()));

    options.maxInactivity = 3600;
    options.supportedCommands = cast.framework.messages.Command.ALL_BASIC_MEDIA;
    castDebugLogger.setEnabled(true);

    // Show debug overlay
    castDebugLogger.showDebugLogs(true);

    let useLegacyDashSupport = false;

    if (context.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')) {
        // The device and display can both do 4k.  Assume a 4k limit.
        castDebugLogger.info("Hardware Resolution: ", '3840x2160');;
        options.touchScreenOptimizedApp = true;
    } else {
        // Chromecast has always been able to do 1080p.  Assume a 1080p limit.
        castDebugLogger.info("Hardware Resolution: ", '1920x1080');
        useLegacyDashSupport = true;
    }

    options.useLegacyDashSupport = useLegacyDashSupport;
    context.loadPlayerLibraries(useLegacyDashSupport);

    context.addEventListener(cast.framework.system.EventType.ERROR, event => {
        castDebugLogger.info('Context Error - ', JSON.stringify(event));
    });

    playerManager.addEventListener(cast.framework.events.EventType.ERROR, event => {
        castDebugLogger.info('Error - ', "ERROR event: " + JSON.stringify(event));
    });

    playerManager.addEventListener(cast.framework.events.EventType.MEDIA_STATUS, (event) => {
        castDebugLogger.info('Player State - ', event.mediaStatus.playerState);
    });

    // Intercept the LOAD request to be able to read in a contentId and get data.
    playerManager.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, loadRequestData => {

        castDebugLogger.info('LoadRequest Data - ', JSON.stringify(loadRequestData));

        const error = new cast.framework.messages.ErrorData(cast.framework.messages.ErrorType.LOAD_CANCELLED);

        if (!loadRequestData.media) {
            error.reason = cast.framework.messages.ErrorReason.INVALID_PARAM;
            return error;
        }

        if (!loadRequestData.media.contentId) {
            error.reason = cast.framework.messages.ErrorReason.INVALID_PARAM;
            return error;
        }

        loadRequestData.autoplay = true;

        let url = loadRequestData.media.contentId;
        castDebugLogger.info('Content Id - ', url);

        const ext = url.substring(url.lastIndexOf('.'), url.length);

        loadRequestData.media.contentType = 'video/mp4';
        if (ext.includes('mpd')) {
            loadRequestData.media.contentType = 'application/dash+xml';
        } else if (ext.includes('m3u8')) {
            loadRequestData.media.contentType = 'application/vnd.apple.mpegurl';
            // TODO: Create option to set hlsSegmentFormat option.
            loadRequestData.media.hlsSegmentFormat = cast.framework.messages.HlsSegmentFormat.TS;
        } else if (ext.includes('ism')) {
            loadRequestData.media.contentType = 'application/vnd.ms-sstr+xml';
        }


        if (loadRequestData.media.customData && loadRequestData.media.customData.drm) {
            playerManager.setMediaPlaybackInfoHandler((loadRequest, playbackConfigData) => {
                playbackConfigData.licenseUrl = loadRequest.media.customData.drm.widevine.url;
                playbackConfigData.protectionSystem =  cast.framework.ContentProtection.WIDEVINE;

                castDebugLogger.info('PlaybackConfig Data - ', JSON.stringify(playbackConfigData));

                return playbackConfigData;
            });
        }

        return loadRequestData;
    });

    options.playbackConfig = playbackConfig;

    context.start(options);
</script>
...