使用未经修改的cast-custom-receiver示例,在尝试加载HLS媒体流时,我在media_player.js库中不断收到未被捕获的InvalidStateError异常。我的HLS流有三种变体。
我不相信这是一个CORS问题,因为我的接收器应用程序和视频源目前都在S3上一起托管用于测试目的。
根据记录,我使用的是简单的Chrome发件人(CastHelloVideo-chrome的修改版本)并已将sender和receiver来源公开发布到Amazon S3以及我正在使用HLS流进行测试。
以下是我在发件人触发加载媒体事件时看到的接收器控制台输出:
[ 0.919s] [cast.receiver.IpcChannel] Opening message bus websocket
[ 0.931s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/v2/ipc
[ 0.970s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/v2/ipc
[ 0.980s] [cast.receiver.IpcChannel] IpcChannel opened
[ 0.989s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"type":"opened"}
[ 0.996s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
[ 1.000s] [cast.receiver.CastReceiverManager] Underlying message bus is open
[ 1.003s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{\"type\":\"ready\",\"statusText\":\"Ready to play\",\"activeNamespaces\":[\"urn:x-cast:com.google.devrel.custom\",\"urn:x-cast:com.google.cast.media\"],\"version\":\"2.0.0\",\"messagesVersion\":\"1.0\"}"}
[ 1.015s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{\"type\":\"startheartbeat\",\"maxInactivity\":6000}"}
[ 1.025s] [cast.receiver.IpcChannel] Received message: {"data":"{\"applicationId\":\"CE156522\",\"applicationName\":\"Simple.TV Test\",\"launchingSenderId\":\"4:client-68913\",\"messagesVersion\":\"1.0\",\"sessionId\":\"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6\",\"type\":\"ready\",\"version\":\"1.0\"}","namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender"}
[ 1.028s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"applicationId":"CE156522","applicationName":"Simple.TV Test","launchingSenderId":"4:client-68913","messagesVersion":"1.0","sessionId":"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6","type":"ready","version":"1.0"}
[ 1.030s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
[ 1.032s] [cast.receiver.CastReceiverManager] Dispatching CastReceiverManager system ready event [[object Object]]
### Cast Receiver Manager is READY: {"type":"ready","B":false,"defaultPrevented":false,"Qa":true,"data":{"id":"CE156522","name":"Simple.TV Test","sessionId":"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6","namespaces":["urn:x-cast:com.google.devrel.custom","urn:x-cast:com.google.cast.media"],"launchingSenderId":"4:client-68913"}}
[ 1.087s] [cast.receiver.IpcChannel] Received message: {"data":"{\"senderId\":\"4:client-68913\",\"type\":\"senderconnected\",\"userAgent\":\"\"}","namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender"}
[ 1.089s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"senderId":"4:client-68913","type":"senderconnected","userAgent":""}
[ 1.092s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
[ 1.094s] [cast.receiver.CastReceiverManager] Dispatching CastReceiverManager sender connected event [4:client-68913]
[ 1.096s] [cast.receiver.CastMessageBus] Registering sender [urn:x-cast:com.google.devrel.custom, 4:client-68913]
[ 1.098s] [cast.receiver.CastMessageBus] Registering sender [urn:x-cast:com.google.cast.media, 4:client-68913]
### Cast Receiver Manager - Sender Connected : {"type":"senderconnected","B":false,"defaultPrevented":false,"Qa":true,"data":"4:client-68913"}
[ 21.168s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"LOAD\",\"requestId\":90616069,\"sessionId\":\"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6\",\"media\":{\"contentId\":\"http://stvdemo.s3.amazonaws.com/chromecast/video/tv.main.hls-0.m3u8\",\"streamType\":\"buffered\",\"contentType\":\"application/x-mpegURL\",\"metadata\":null,\"duration\":1800,\"customData\":null},\"autoplay\":false,\"currentTime\":0,\"customData\":null}","namespace":"urn:x-cast:com.google.cast.media","senderId":"4:client-68913"}
[ 21.174s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 4:client-68913]: {"type":"LOAD","requestId":90616069,"sessionId":"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6","media":{"contentId":"http://stvdemo.s3.amazonaws.com/chromecast/video/tv.main.hls-0.m3u8","streamType":"buffered","contentType":"application/x-mpegURL","metadata":null,"duration":1800,"customData":null},"autoplay":false,"currentTime":0,"customData":null}
[ 21.183s] [cast.receiver.MediaManager] MediaManager message received [4:client-68913] {"type":"LOAD","requestId":90616069,"sessionId":"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6","media":{"contentId":"http://stvdemo.s3.amazonaws.com/chromecast/video/tv.main.hls-0.m3u8","streamType":"buffered","contentType":"application/x-mpegURL","metadata":null,"duration":1800,"customData":null},"autoplay":false,"currentTime":0,"customData":null}
[ 21.187s] [cast.receiver.MediaManager] Dispatching MediaManager load event
### Media Manager - LOAD: {"type":"load","B":false,"defaultPrevented":false,"Qa":true,"data":{"requestId":90616069,"sessionId":"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6","media":{"contentId":"http://stvdemo.s3.amazonaws.com/chromecast/video/tv.main.hls-0.m3u8","streamType":"buffered","contentType":"application/x-mpegURL","metadata":null,"duration":1800,"customData":null},"autoplay":false,"currentTime":0,"customData":null},"senderId":"4:client-68913"}
### Media Protocol Identified as m3u8
######### MEDIA ELEMENT LOAD START
Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable. media_player.js:101
######### MEDIA ELEMENT ERROR [object Event]
[ 22.299s] [cast.receiver.MediaManager] Load metadata error
### Media Manager - LOAD METADATA ERROR: {"senderId":"4:client-68913","message":{"requestId":90616069,"sessionId":"A2A4AA7B-5CE5-9CA0-38CA-EEC77B84F4C6","media":{"contentId":"http://stvdemo.s3.amazonaws.com/chromecast/video/tv.main.hls-0.m3u8","streamType":"buffered","contentType":"application/x-mpegURL","metadata":null,"duration":1800,"customData":null},"autoplay":false,"currentTime":0,"customData":null}}
[ 22.310s] [cast.receiver.MediaManager] Resetting media element
[ 22.319s] [cast.receiver.MediaManager] Sending error message to 4:client-68913
[ 22.324s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"4:client-68913","data":"{\"requestId\":90616069,\"type\":\"LOAD_FAILED\"}"}