我正在尝试从我的Android发件人播放M3U8文件,如下所示:
metaData = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
metaData.putString(MediaMetadata.KEY_TITLE, "Demo Video");
MediaInfo mediaInfo = new MediaInfo.Builder(
"http://www.corsproxy.com/playertest.longtailvideo.com/adaptive/bbbfull/bbbfull.m3u8")
.setContentType("application/vnd.apple.mpegurl")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(metaData)
.build();
player.load(client, mediaInfo, true)
.setResultCallback(new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() {
@Override
public void onResult(RemoteMediaPlayer.MediaChannelResult mediaChannelResult) {
Status status = mediaChannelResult.getStatus();
if (status.isSuccess()) {
}
}
});
但是,我收到了错误
[cast.receiver.MediaManager] Load metadata error
[cast.player.api.Player] error
[cast.receiver.MediaManager] Load metadata error
[cast.receiver.MediaManager] Not sending LOAD error as there is no on going LOAD request
这是一款Styled Media Receiver,我的理解是它正在使用媒体播放器库,所以它应该能够正确处理M3U8吗?所以我认为这可能是我的发件人部分的错误?我正确加载m3u8网址吗?
答案 0 :(得分:0)
你可以在已解析的m3u8条目上尝试exp / imp循环,将你的m3su attrs放在u c“movieMetadata”...
private static MediaInfo buildMediaInfo(String title,
String subTitle, String studio, String url, String imgUrl, String bigImageUrl) {
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subTitle);
movieMetadata.putString(MediaMetadata.KEY_TITLE, title);
movieMetadata.putString(MediaMetadata.KEY_STUDIO, studio);
movieMetadata.addImage(new WebImage(Uri.parse(imgUrl)));
movieMetadata.addImage(new WebImage(Uri.parse(bigImageUrl)));
return new MediaInfo.Builder(url)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType(getMediaType())
.setMetadata(movieMetadata)
.build();
}
然后当你有一个MediaInfo ...你需要一些东西的播放事件,你需要在每个播放项目的末尾有一个looper来指示下一个MediaInfo条目的播放事件。我使用CCL lib构建了循环,它播放了MediaInfo项目列表。