我正在构建一个iOS应用,将视频内容从DLNA / UPnP媒体服务器投射到Chromecast。当我为字幕添加媒体轨道数据时出现问题。以下作品:
### Media Manager - LOAD: {
"type":"load",
"I":false,
"defaultPrevented":false,
"kb":true,
"data":
{
"currentTime":0,
"requestId":3,
"autoplay":true,
"media":
{
"metadata":
{
"title":"movie.mp4",
"subtitle":"Unknown",
"images":
[{
"url":"http://192.168.1.15:8895/resource/625/COVER_IMAGE",
"width":200,
"height":100
}],
"metadataType":0
},
"textTrackStyle":
{
"windowRoundedCornerRadius":8,
"windowType":"ROUNDED_CORNERS",
"foregroundColor":"#FFFFFFFF",
"fontFamily":"Helvetica",
"fontGenericFamily":"SANS_SERIF",
"fontStyle":"BOLD",
"fontScale":1,
"windowColor":"#000000FF",
"backgroundColor":"#000000FF"
},
"contentId":"http://192.168.1.15:8895/resource/338/MEDIA_ITEM/AVC_MP4_MP_SD_AAC_MULT5-0/ORIGINAL",
"contentType":"video/mp4",
"streamType":"NONE",
"duration":0
}
},
"senderId":"33:3EA56D16-D18E-4D13-87A0-717DC188F8AF"}
但是当我添加自己的标题或者来自CastVideos示例应用程序的标题时(为了确保它已启用CORS),它将无法使用:
### Media Manager - LOAD: {
"type":"load",
"I":false,
"defaultPrevented":false,
"kb":true,
"data":
{
"currentTime":0,
"requestId":4,
"autoplay":true,
"media":
{
"tracks":
[{
"trackId":1,
"trackContentId":"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/GoogleIO-2014-CastingToTheFuture2-en.vtt",
"language":"en-US",
"subtype":"CAPTIONS",
"type":"TEXT",
"trackContentType":"text/vtt",
"name":"English Subtitle"
}],
"contentId":"http://192.168.1.15:8895/resource/338/MEDIA_ITEM/AVC_MP4_MP_SD_AAC_MULT5-0/ORIGINAL",
"streamType":"NONE",
"contentType":"video/mp4",
"duration":0,
"metadata":
{
"title":"movie.mp4",
"subtitle":"Unknown",
"images":
[{
"url":"http://192.168.1.15:8895/resource/625/COVER_IMAGE",
"width":200,
"height":100
}],
"metadataType":0
},
"textTrackStyle":
{
"windowRoundedCornerRadius":8,
"windowType":"ROUNDED_CORNERS",
"foregroundColor":"#FFFFFFFF",
"fontFamily":"Helvetica",
"fontGenericFamily":
"SANS_SERIF",
"fontStyle":"BOLD",
"fontScale":1,
"windowColor":
"#000000FF",
"backgroundColor":"#000000FF"
}
}
},
"senderId":"11:9D7D43C2-CD85-4143-82AA-2D0056AA62FC" }
我明白了:
[cast.receiver.MediaManager] Load metadata error cast_receiver.js:18
然而,Sample应用程序与我的自定义接收器中的标题一起使用没有任何问题,我没有发现太大的区别(视频/图像http URL除外,我只是收到警告):
### Media Manager - LOAD: {
"type":"load",
"I":false,
"defaultPrevented":false,
"kb":true,
"data":
{
"currentTime":0,
"requestId":3,
"autoplay":true,
"media":
{
"tracks":
[{
"trackId":1,
"trackContentId":"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/DesigningForGoogleCast-en.vtt",
"language":"en-US",
"subtype":"CAPTIONS",
"type":"TEXT",
"trackContentType":"text/vtt",
"name":"English Subtitle"
}],
"contentId":"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/DesigningForGoogleCast.mp4",
"streamType":"NONE",
"contentType":"video/mp4",
"duration":0,
"metadata":
{
"title":"Designing For Google Cast",
"subtitle":"Google IO - 2014",
"images":
[{
"url":"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images_480x270/DesigningForGoogleCast2-480x270.jpg",
"width":200,
"height":100
}],
"metadataType":0
},
"textTrackStyle":
{
"windowRoundedCornerRadius":8,
"windowType":"ROUNDED_CORNERS",
"foregroundColor":"#FFFFFFFF",
"fontFamily":"Helvetica",
"fontGenericFamily":"SANS_SERIF",
"fontStyle":"BOLD",
"fontScale":1,
"windowColor":"#000000FF",
"backgroundColor":"#000000FF"
}
}
},
"senderId":"46:F162E34A-1A6D-4C0C-A0A3-DB584C92CDF5" }
任何想法?
提前感谢。
答案 0 :(得分:1)
在Chromecast中使用字幕时,CORS不仅需要字幕,还需要视频流。就我而言,视频HTTP服务器(例如Serviio)不支持它。