googlecast / CastVideos-android

Reference Android Sender w/ Framework API: CastVideos-android application shows how to cast videos from an Android device that is fully compliant with the Cast Design Checklist.
Apache License 2.0
345 stars 183 forks source link

how to pass drawable image to MediaMetadata in chromecast #90

Open vikasacharya16 opened 4 years ago

vikasacharya16 commented 4 years ago

I'm integrating chromecast into my application. when i'm building media info

private fun buildMediaInfo(video_url: String?): MediaInfo? {
        try {
            val movieMetadata = MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE)
            movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, sub_title)
            movieMetadata.putString(MediaMetadata.KEY_TITLE, title)
            if (image_url != null) {
                movieMetadata.addImage(WebImage(Uri.parse(getSignedUrl(image_url))));
            } else { 
             ...
             // need to implement
             ...
            }
.....
.....
.....

}

i tried something like below but it is not working

val img_uri = Uri.parse("android.resource://${context!!.packageName.toString()}/drawable/play_movie_card_no_film");
movieMetadata.addImage(WebImage(img_uri))

anyone know how to set local image into movieMetadata while integrating chromecast