Google Cast:Load Metadata Error and No Access Control Allow



我尝试用我的Android应用程序播放流。流来自我自己网络中的卫星接收器。我通过http链接访问流,如:

http://192.168.188.23:8001/1:0:19:283D:3FB:1:C00000:0

当我在VLC中打开流时,我会得到以下编解码器信息:

类型:视频/编解码器:H264-MPEG-4 AVC(第10部分)(H264)

在我的应用程序中,我构建了这个MediInfo:

private static MediaInfo buildMediaInfo(String title, String subTitle, String studio, String url, String imgUrl, String bigImageUrl, List<MediaTrack> tracks) {
    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);
    return new MediaInfo.Builder(url)
            .setStreamType(MediaInfo.STREAM_TYPE_LIVE)
            .setContentType("video/mp4")
            .setMetadata(movieMetadata)
            .setMediaTracks(tracks)
            .build();
}

错误日志从我的Chromecast:

Failed to load resource: the server responded with a status of 404 (Not Found) https://www.gstatic.com/eureka/player/undefined  
[0.292s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/v2/ipc cast_receiver.js:18
The page at 'https://www.gstatic.com/eureka/player/player.html?skin' was loaded over HTTPS, but ran insecure content from 'ws://localhost:8008/v2/ipc': this content should also be loaded over HTTPS. player.html:1 
Connecting to a non-secure WebSocket server from a secure origin is deprecated. player.html:1  
[0.428s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/v2/ipc cast_receiver.js:18
Failed to load resource: the server responded with a status of 404 (Not Found) https://www.gstatic.com/eureka/player/undefined
The page at 'https://www.gstatic.com/eureka/player/player.html?skin' was loaded over HTTPS, but displayed insecure content from 'http://192.168.188.23:8001/1:0:19:283D:3FB:1:C00000:0:0:0:': this content should also be loaded over HTTPS.  media_player.js:38 
XMLHttpRequest cannot load http://192.168.188.23:8001/1:0:19:283D:3FB:1:C00000:0:0:0:. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.gstatic.com' is therefore not allowed access. player.html:1  
[ 13.011s] [cast.receiver.MediaManager] Load metadata error cast_receiver.js:18
nb cast_receiver.js:18
kb.Yb cast_receiver.js:18
B.log cast_receiver.js:13
I cast_receiver.js:16
Z.ra cast_receiver.js:88
g.ra cast_receiver.js:53
Ib cast_receiver.js:23
Fb cast_receiver.js:24
(anonymous function) cast_receiver.js:21
e.onError player.js:53
K media_player.js:61
Ie.Ba media_player.js:117
R.yb media_player.js:67
pc media_player.js:34
h.dispatchEvent media_player.js:33
Hc media_player.js:39
Jc media_player.js:42
D.dh media_player.js:40
D.tf media_player.js:40

我无法改变溪流本身的某些东西。

这是我的代码中的问题还是来自我的Sat接收器(流)&当我的卫星接收器出现问题时,有解决方案吗?

编辑:

在解决CORS问题后,新的错误日志:

Failed to load resource: the server responded with a status of 404 (Not Found) https://www.gstatic.com/eureka/player/undefined
 [  0.280s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/v2/ipc cast_receiver.js:18
The page at 'https://www.gstatic.com/eureka/player/player.html?skin' was loaded over HTTPS, but ran insecure content from 'ws://localhost:8008/v2/ipc': this content should also be loaded over HTTPS.
 player.html:1
Connecting to a non-secure WebSocket server from a secure origin is deprecated. player.html:1
 [  0.367s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/v2/ipc cast_receiver.js:18
Failed to load resource: the server responded with a status of 404 (Not Found) https://www.gstatic.com/eureka/player/undefined
The page at 'https://www.gstatic.com/eureka/player/player.html?skin' was loaded over HTTPS, but displayed insecure content from 'http://192.168.188.32/teststream1.php': this content should also be loaded over HTTPS.
 cast_receiver.js:55
 [ 12.071s] [cast.receiver.MediaManager] Load metadata error cast_receiver.js:18
 nb cast_receiver.js:18
 kb.Yb cast_receiver.js:18
 B.log cast_receiver.js:13
 I cast_receiver.js:16
 Z.ra cast_receiver.js:88
 g.ra cast_receiver.js:53
 Ib cast_receiver.js:23
 Fb cast_receiver.js:24
 (anonymous function) cast_receiver.js:21

第2版:流的头看起来像这样(用php捕获):

[0] => HTTP/1.0 200 OK
[1] => Date: Sat, 04 Oct 2014 18:38:23 GMT
[2] => Server: Apache/2.2.22 (Debian)
[3] => X-Powered-By: PHP/5.4.4-14+deb7u9
[4] => Connection: Close
[5] => Access-Control-Allow-Origin: *
[6] => Content-Type: video/mpeg

当我在VLC中打开流时,我会得到以下编解码器信息:

类型:视频/编解码器:H264-MPEG-4 AVC(第10部分)(H264)

安卓代码同上。

接收方:https://github.com/googlecast/Cast-Simple-Receiver/blob/master/receiver.html

编辑3

具有自定义样式的适配器和优化代码:

错误日志转换:

cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
undefined
 [405.177s] [cast.receiver.IpcChannel] Received message: {"data":"{"currentTime":0,"type":"LOAD","media":{"streamType":"BUFFERED","duration":0,"contentType":"video\/mpeg","contentId":"http:\/\/192.168.188.32\/teststream1.php","metadata":{"subtitle":"Auslandskorrespondenten berichten","studio":"Das Erste HD","title":"Weltspiegel","metadataType":1}},"requestId":2,"autoplay":true}","namespace":"urn:x-cast:com.google.cast.media","senderId":"229:de.resper.e2cast-22"} cast_receiver.js:18
 [405.187s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message cast_receiver.js:18
 [405.193s] [cast.receiver.MediaManager] MediaManager message received cast_receiver.js:18
 [405.198s] [cast.receiver.MediaManager] Dispatching MediaManager load event cast_receiver.js:18
 [406.017s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{"type":"setappstate","statusText":"Now Casting: Weltspiegel"}"} cast_receiver.js:18
 [406.046s] [cast.receiver.MediaManager] Load - contentId: http://192.168.188.32/teststream1.php autoplay: true time: 0 cast_receiver.js:18
The page at 'https://www.gstatic.com/eureka/player/player.html?skin' was loaded over HTTPS, but displayed insecure content from 'http://192.168.188.32/teststream1.php': this content should also be loaded over HTTPS.
 cast_receiver.js:55
 [408.624s] [cast.receiver.MediaManager] Load metadata error cast_receiver.js:18nb cast_receiver.js:18kb.Yb cast_receiver.js:18B.log cast_receiver.js:13I cast_receiver.js:16Z.ra cast_receiver.js:88g.ra cast_receiver.js:53Ib cast_receiver.js:23Fb cast_receiver.js:24(anonymous function) cast_receiver.js:21
 [409.519s] [cast.receiver.MediaManager] Sending error message to 229:de.resper.e2cast-22 cast_receiver.js:18
 [409.523s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"229:de.resper.e2cast-22","data":"{"requestId":2,"type":"LOAD_FAILED"}"} cast_receiver.js:18
 [410.301s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{"type":"setappstate","statusText":"Ready To Cast"}"} cast_receiver.js:18

我在你的帖子中没有看到任何问题,所以我不确定你到底在问什么;您提到的错误表明,您遇到了chromecast(基于W3C要求)所需的CORS问题,而Cast SDK方面无法解决此问题。

相关内容

  • 没有找到相关文章

最新更新