2014-02-09 1 views
2

크롬 발신자 응용 프로그램이 기본 미디어 수신 응용 프로그램에 메타 데이터를 보내려고하지만 기본 미디어 수신자가 메타 데이터를 표시하지 않도록하려고합니다. 설명서 나 예제를 찾을 수 없습니다. 아무도 이것을 구현하는 방법을 알고 있습니까? 아래 코드는 오디오를 재생하지만 플레이어는 이미지 나 다른 메타 데이터를 표시하지 않습니다.Google Cast : 기본 미디어 플레이어에 메타 데이터를 표시하는 방법?

초기화 :

var sessionRequest = new chrome.cast.SessionRequest(chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID); 
    var apiConfig = new chrome.cast.ApiConfig(sessionRequest, 
    sessionListener, 
    receiverListener); 
    chrome.cast.initialize(apiConfig, onInitSuccess, onError); 
    chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError); 

...

용지 넣기

url = "url-to-media" 
var mediaInfo = new chrome.cast.media.MediaInfo(url, 'audio/aac'); 
mediaInfo.metadata = new chrome.cast.media.MusicTrackMediaMetadata() 
mediaInfo.metadata.albumName = 'This is the name of the album' 
mediaInfo.metadata.artistName = 'This is the name of the artist' 
mediaInfo.metadata.songName = 'This is the name of the song' 
im = chrome.cast.Image('http://m1.behance.net/rendition/modules/575407/disp/822271229466847.png') 
mediaInfo.metadata.images = new Array(im) 
var request = new chrome.cast.media.LoadRequest(mediaInfo); 
session.loadMedia(request,onMediaDiscovered.bind(this, 'loadMedia'), onMediaError()) 

답변

4

이 시도 -

mediaInfo.metadata.title = 'This is the name of the song'; 
mediaInfo.metadata.subtitle = 'This is the name of the artist'; 
+0

감사 :

은 또한에 샘플 코드를 제공 GitHub의에 프로젝트를 추가! 이것이 어딘지에 문서화되어 있다면 알 수 있습니까? –

+0

기본 수신기에서 미디어 이미지를 가져 오는 방법이 있습니까? –

+1

이미지를 보려면 다음을 시도하십시오. - var image = new chrome.cast.Image (imageUrl); mediaInfo.metadata.images = [image];'여기에서 찾을 수 있습니다. [https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata] –

1

현재 기본 미디어 수신자 앱은 특정 메타 데이터 필드를 허용합니다. 자세한 사양은 https://developers.google.com/cast/docs/reference/messages입니다.

MusicTrackMediaMetaData 유형의 경우 metadataType을 3으로 설정해야합니다. 다음 스 니펫이 작동합니다.

mediaInfo.metadata = new chrome.cast.media.MusicTrackMediaMetadata() 
mediaInfo.metadata.metadataType = 3; 
mediaInfo.metadata.title = 'This is the name of the title'; 
mediaInfo.metadata.albumArtist = 'This is the name of the album artist'; 
mediaInfo.metadata.artist = 'This is the name of the artist'; 
mediaInfo.metadata.albumName = 'This is the name of the album'; 
//mediaInfo.metadata.composer = 'composer'; 
//mediaInfo.metadata.trackNumber = 13; 
//mediaInfo.metadata.discNumber = 2; 
mediaInfo.metadata.releaseDate = '2011'; 
mediaInfo.metadata.images = [{'url': 'http://m1.behance.net/rendition/modules/575407/disp/822271229466847.png'}];    
var request = new chrome.cast.media.LoadRequest(mediaInfo); 
session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError()); 

Chrome Sender SDK와 기본 수신자 앱 간의 일부 불일치 문제를 해결하는 버그가 접수되었습니다.

언제든지 자신 만의 맞춤형 수신기 앱을 만들 수 있으며 다음과 같은 나만의 맞춤 데이터를 추가 할 수 있습니다.

var mediaInfo = new chrome.cast.media.MediaInfo(url, 'audio/mp3'); 
var request = new chrome.cast.media.LoadRequest(mediaInfo); 
var payload = { 
    "albumName": 'This is the name of the album', 
    "songName": 'This is the name of the song', 
    "thumb": 'http://m1.behance.net/rendition/modules/575407/disp/822271229466847.png', 
    "artistName": 'This is the name of the artist' 
}; 
var json = { 
    "payload": payload 
}; 
request.customData = json; 
+0

버그 신고? google-cast-sdk 추적 프로그램에서 찾을 수 없습니다. –