Skip to content

Chromecast Casting Fails When Using "Redirect (No Transcoding)" Stream Profile #128

Description

@ginjeira

Environment
ViniPlay version: 0.11.0
Docker image: ardovini/viniplay:latest
Chromecast with Google TV
Android TV devices
Active Stream Profile: Redirect (No Transcoding)
Active Cast Profile: Cast Default (CPU)
Problem

When the active stream profile is set to Redirect (No Transcoding), local playback works correctly, but Chromecast casting fails.

The Cast session starts successfully and connects to the device, but the ViniPlay UI shows:

No Media Loaded

and nothing is played on the Chromecast.

If the active stream profile is changed to an FFmpeg-based profile, casting starts working, although transcoding-related issues may appear depending on the source stream.

Root Cause

After debugging the issue, it appears that cast.js does not correctly handle streams when the active profile is redirect.

The Chromecast receives the original IPTV URL directly:

https://provider.example/live/user/pass/channel.ts

and ViniPlay appends:

?profileId=cast-default
&castToken=xxxx

resulting in something similar to:

https://provider.example/live/user/pass/channel.ts?profileId=cast-default&castToken=xxxx

This URL never passes through ViniPlay's /stream endpoint.

As a result:

Cast authentication token validation is bypassed.
The selected Cast profile is not applied.
No FFmpeg process is started.
Chromecast reports "No Media Loaded".
Additional Issue

After modifying the code to route Chromecast traffic through /stream, another problem appeared.

The generated URL did not include userAgentId.

Server logs showed:

User agent with ID "undefined" not found in settings.

The /stream endpoint requires a valid User Agent ID, but cast.js was not passing the currently selected user agent.

Working Fix

  1. Route direct IPTV URLs through /stream

Instead of sending the original IPTV URL directly to Chromecast:

let castUrl = url;

generate a ViniPlay stream URL:

castUrl =
${window.location.origin}/stream?url=${encodeURIComponent(url)};
2. Pass the active User Agent ID

Add:

const activeUserAgentId =
guideState.settings?.activeUserAgentId;

and generate:

castUrl =
${window.location.origin}/stream?url=${encodeURIComponent(url)}&userAgentId=${activeUserAgentId};
Result

After applying these changes:

Local playback works correctly.
Chromecast casting works correctly.
Redirect profile can be used as the primary playback profile.
No transcoding is required for normal playback.
Chromecast successfully uses the configured Cast profile.
Suggestion

It may be worth reviewing the Chromecast URL generation logic in public/js/modules/cast.js when the active stream profile is redirect, as the current implementation appears to bypass the ViniPlay streaming endpoint and omits the required userAgentId parameter.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions