Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitles not displayed in CastPlayer #10302

Closed
anup1245 opened this issue May 27, 2022 · 1 comment
Closed

Subtitles not displayed in CastPlayer #10302

anup1245 opened this issue May 27, 2022 · 1 comment
Assignees
Labels

Comments

@anup1245
Copy link

anup1245 commented May 27, 2022

Hi I was trying use cast player to cast video, but subtitles are not shown. I saw the code, and could not find a way to populate subtitles.
I tried to use Custom MediaItemConverter but it did not help

  override fun toMediaQueueItem(mediaItem: MediaItem): MediaQueueItem {
    val metadata = com.google.android.gms.cast.MediaMetadata(
      com.google.android.gms.cast.MediaMetadata.MEDIA_TYPE_MOVIE
    )
   
    val mediaInfo = MediaInfo.Builder(mediaItem.playbackProperties!!.uri.toString())
      .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
      .setContentType(mediaItem.playbackProperties!!.mimeType!!)
      .setMetadata(metadata)
      .setMediaTracks(createSubtitleMediaTracks(mediaItem.playbackProperties?.subtitles))
      .setCustomData(getCustomData(mediaItem))
      .build()
    return MediaQueueItem.Builder(mediaInfo).build()
  }

I see in the CastPlayer, the video is loaded using

remoteMediaClient.queueLoad(
        mediaQueueItems,
        min(startIndex, mediaQueueItems.length - 1),
        getCastRepeatMode(repeatMode),
        startPositionMs,
        /* customData= */ null);

That does not set any active track ids for subtitles. If we use

remoteMediaClient.load(mediaInfo, mediaLoadOptions)

that sets setActiveTrackIds

Also using StyledPlayerView for normal play on device, but when casting, the captions button is disabled.

Is there a way to cast subtitles using Cast Player?

using exoplayer 2.15.1

@marcbaechinger
Copy link
Contributor

marcbaechinger commented May 30, 2022

This is currently not supported with CastPlayer. Accordingly CastPayer does not advertise this feature and the StyledPlayerView correctly does not offer setting text tracks.

Thanks for reporting. I'm closing as a duplicate of #8669.

@google google locked and limited conversation to collaborators Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants