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

Casting failure for M3u8 files #7295

Open
harshmittal29 opened this issue Apr 27, 2020 · 6 comments
Open

Casting failure for M3u8 files #7295

harshmittal29 opened this issue Apr 27, 2020 · 6 comments
Assignees

Comments

@harshmittal29
Copy link

[REQUIRED] Issue description

When executing some of the URL's I am getting following error.

I am using HLS (.m3u8) URL's to be played on Exoplayer and casting them to cast receiver.
URL's plays fine on Exoplayer but throws below error when cast.

MediaControlChannel: received unexpected error: Invalid Request.
MediaQueue: Error fetching queue item ids, statusCode=2100, statusMessage=null

[REQUIRED] Reproduction steps

My code :

private fun loadRemoteMedia(position: Int) {
        if (mCastSession == null) {
            return
        }
        val remoteMediaClient: RemoteMediaClient? = mCastSession?.remoteMediaClient

        val videoURL = mTrack?.videoUri
        val subTitle = ResourceUtils.getString(R.string.cast_casting_to_device, mCastSession?.castDevice?.friendlyName)
        if (!videoURL.isNullOrEmpty()) {
            mSelectedMedia = CastVideoProvider.buildMediaInfo(mTrack?.trackId.toString(), mTrack?.title
                    ?: "", subTitle, Integer.parseInt(mTrack?.duration
                    ?: "0"), videoURL,
                    VideoModule.getInstance().getMimeType(mActivity, Uri.parse(videoURL)), mTrack?.thumbnailUri
                    ?: "", null)
        }

        remoteMediaClient ?: return

        remoteMediaClient.registerCallback(object : RemoteMediaClient.Callback() {
            override fun onStatusUpdated() {
                ExpandedCastingActivity.startActivity(mActivity, mSelectedMedia)
                remoteMediaClient.unregisterCallback(this)
            }
        })

         remoteMediaClient.load(MediaLoadRequestData.Builder()
                    .setMediaInfo(mSelectedMedia)
                    .setAutoplay(true)
                    .setCurrentTime(position.toLong()).build())
    }
fun buildMediaInfo(contentId: String, title: String,
                       subTitle: String,
                       duration: Int, url: String, mimeType: String, imgUrl: String,
                       tracks: List<MediaTrack>?): MediaInfo {
        val movieMetadata = MediaMetadata(MEDIA_TYPE_MOVIE)
        movieMetadata.putString(MediaMetadata.KEY_TITLE, title)
        movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subTitle)
        if (!StringUtil.isNullOrEmpty(imgUrl)) {
            movieMetadata.addImage(WebImage(Uri.parse(imgUrl)))
        }
        return MediaInfo.Builder(contentId)
                .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                .setContentUrl(url)
                .setContentType(mimeType)
                .setStreamDuration(duration.toLong())
                .build()
    }

[REQUIRED] Link to test content

Emailed you the content URL

[REQUIRED] Version of ExoPlayer being used

Casting framework version : 18.1.0
Exoplayer version : 2.11.1

[REQUIRED] Device(s) and version(s) of Android being used

Pixel 3 on Android Q
Chromecast 3

@AquilesCanta
Copy link
Contributor

AquilesCanta commented Apr 28, 2020

I suspect by throw you don't refer to an exception, but rather that it logs those provided lines.

I have reported the issue to the cast team, and will reach back once I have any responses from them. Thanks for your patience. [Internal ref: Originally b/144421854, then forked to b/156465430].

@harshmittal29
Copy link
Author

@AquilesCanta The videos do not play and show the logs provided above. It happens for certain form videos with certain audio encoding. When I debugged more I noted the format of audio stream it fails to cast. Attaching below. I have also emailed with subject Issue #7295 the video file for further diagnosis.

Extraordinary - audio codecs

@AquilesCanta
Copy link
Contributor

Yeas, thanks @harshmittal29. I have sent a report to the cast team and will reach back once they reply. Since the issue occurs in the default receiver app, which the ExoPlayer team doesn't own, there is not much in our hands to do for debugging this.

@harshmittal29
Copy link
Author

Hello @AquilesCanta checking on this again. Any help on this would be great.

@AquilesCanta
Copy link
Contributor

No news. Unfortunately there's not much I can do from here other than wait for updates from the cast team. I'll ping the bug again.

@Ivozn
Copy link

Ivozn commented Dec 29, 2020

Hello, there is any update on this issue? Anything from the cast team? I'm having the same problem.

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

No branches or pull requests

3 participants