I am developing a little music Player and I am trying to cast the current song to Chromecast. My app is based on Folders, so I manage mp3 or flac Files as songs.
I am following this Google Developers tutorial and I have written my Android Sender with the Media Chanel. If I do this, a song uploaded to dropbox plays succesfully on my TV.
MediaMetadata mediaMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MUSIC_TRACK);
MediaInfo mediaInfo = new MediaInfo.Builder(
"https://dl.dropboxusercontent.com/u/56292608/MySong.mp3")
.setContentType("audio/mp3")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(mediaMetadata)
.build()
mRemoteMediaPlayer.load(mApiClient, mediaInfo, true)
Is any way to cast or stream a File in order to set an URL?
I try with:
Uri.fromFile(myFile).toString()
but i can't send the file. Is any way to build the MediaInfo object reference from a local File path? If not, is any easy way to create a stream from a local path and send this stream to Chromecast?
In other case, it would be better transfering directly the multimedia sound from device with another approach?
Thanks for all