title: Chromecast Custom Receiver JPG loading
body: <p>I am not able to cast a simple JPG or PNG file to chromecast device.
  I keep getting the error message </p>
  
  <pre><code>[cast.receiver.MediaManager] Load metadata error
  </code></pre>
  
  <p>I even tried it with Google's examples "sample_media_receiver.html" and "web_sender_tool.html", but without success.</p>
  
  <p>Video files like MP4 or even HLS work fine, but not an simple image. Altough in the default receiver the images are working, but not in the custom receiver.</p>
  
  <p>I tried with different values of metadata and without any metadata - nothing helps.</p>
  
  <p>Here is the log of the chromecast console (with working MP4 and not working JPG):</p>
  
  <pre><code>### Application Loaded. Starting system. sample_media_receiver.html:605
   [  0.285s] [cast.receiver.IpcChannel] Opening message bus websocket
   cast_receiver.js:19
   [  0.297s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/v2/ipc
   cast_receiver.js:19
   [  0.369s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/v2/ipc
   cast_receiver.js:19
   [  0.380s] [cast.receiver.IpcChannel] IpcChannel opened
   cast_receiver.js:19
   [  0.393s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"type":"opened"}
   cast_receiver.js:19
   [  0.408s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
   cast_receiver.js:19
   [  0.410s] [cast.receiver.CastReceiverManager] Underlying message bus is open
   cast_receiver.js:19
   [  0.413s] [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\"}"}
   cast_receiver.js:19
   [  0.421s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{\"type\":\"startheartbeat\",\"maxInactivity\":6000}"}
   cast_receiver.js:19
   [  0.440s] [cast.receiver.IpcChannel] Received message: {"data":"{\"applicationId\":\"XXXXXXX\",\"applicationName\":\"MDTest\",\"launchingSenderId\":\"8:client-68103\",\"messagesVersion\":\"1.0\",\"sessionId\":\"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69\",\"type\":\"ready\",\"version\":\"1.0\"}","namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender"}
   cast_receiver.js:19
   [  0.443s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"applicationId":"XXXXXXXX","applicationName":"MDTest","launchingSenderId":"8:client-68103","messagesVersion":"1.0","sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","type":"ready","version":"1.0"}
   cast_receiver.js:19
   [  0.446s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
   cast_receiver.js:19
   [  0.448s] [cast.receiver.CastReceiverManager] Dispatching CastReceiverManager system ready event [[object Object]]
   cast_receiver.js:19
  ### Cast Receiver Manager is READY:  sample_media_receiver.html:204
   [  0.567s] [cast.receiver.IpcChannel] Received message: {"data":"{\"senderId\":\"8:client-68103\",\"type\":\"senderconnected\",\"userAgent\":\"\"}","namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender"}
   cast_receiver.js:19
   [  0.570s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"senderId":"8:client-68103","type":"senderconnected","userAgent":""}
   cast_receiver.js:19
   [  0.572s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
   cast_receiver.js:19
   [  0.574s] [cast.receiver.CastReceiverManager] Dispatching CastReceiverManager sender connected event [8:client-68103]
   cast_receiver.js:19
   [  0.576s] [cast.receiver.CastMessageBus] Registering sender [urn:x-cast:com.google.devrel.custom, 8:client-68103]
   cast_receiver.js:19
   [  0.578s] [cast.receiver.CastMessageBus] Registering sender [urn:x-cast:com.google.cast.media, 8:client-68103]
   cast_receiver.js:19
  ### Cast Receiver Manager - Sender Connected :  sample_media_receiver.html:217
   [ 17.252s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"LOAD\",\"requestId\":28532030,\"sessionId\":\"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69\",\"media\":{\"contentId\":\"http://192.168.0.103/~marco/cast/video0.mp4\",\"streamType\":\"buffered\",\"contentType\":\"video/mp4\",\"metadata\":null,\"duration\":null,\"customData\":null},\"autoplay\":true,\"currentTime\":null,\"customData\":null}","namespace":"urn:x-cast:com.google.cast.media","senderId":"8:client-68103"}
   cast_receiver.js:19
   [ 17.255s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 8:client-68103]: {"type":"LOAD","requestId":28532030,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/video0.mp4","streamType":"buffered","contentType":"video/mp4","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
   cast_receiver.js:19
   [ 17.258s] [cast.receiver.MediaManager] MediaManager message received [8:client-68103] {"type":"LOAD","requestId":28532030,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/video0.mp4","streamType":"buffered","contentType":"video/mp4","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
   cast_receiver.js:19
   [ 17.259s] [cast.receiver.MediaManager] Dispatching MediaManager load event
   cast_receiver.js:19
  ### Media Manager - LOAD: {"type":"load","B":false,"defaultPrevented":false,"Qa":true,"data":{"requestId":28532030,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/video0.mp4","streamType":"buffered","contentType":"video/mp4","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null},"senderId":"8:client-68103"} sample_media_receiver.html:549
  ### Media Protocol Identified as mp4 sample_media_receiver.html:588
  ######### MEDIA ELEMENT LOAD START sample_media_receiver.html:121
   [ 18.270s] [cast.receiver.MediaManager] Metadata loaded
   cast_receiver.js:19
   [ 18.286s] [cast.receiver.MediaManager] Sending broadcast status message
   cast_receiver.js:19
   [ 18.300s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"BUFFERING\",\"currentTime\":0,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false},\"media\":{\"contentId\":\"http://192.168.0.103/~marco/cast/video0.mp4\",\"streamType\":\"buffered\",\"contentType\":\"video/mp4\",\"metadata\":null,\"duration\":8.057324,\"customData\":null}}],\"requestId\":28532030}"}
   cast_receiver.js:19
  ######### MEDIA ELEMENT DATA LOADED sample_media_receiver.html:125
  ######### MEDIA ELEMENT CAN PLAY sample_media_receiver.html:129
  ######### MEDIA ELEMENT PLAYING sample_media_receiver.html:137
   [ 20.625s] [cast.receiver.MediaManager] Buffering state changed, isPlayerBuffering: false old time: 0.083322 current time: 1.125
   cast_receiver.js:19
   [ 20.627s] [cast.receiver.MediaManager] Sending broadcast status message
   cast_receiver.js:19
   [ 20.630s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"PLAYING\",\"currentTime\":1.125,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false}}],\"requestId\":0}"}
   cast_receiver.js:19
  ######### MEDIA ELEMENT ENDED sample_media_receiver.html:133
  ### Media Manager - ENDED:  sample_media_receiver.html:347
   [ 27.445s] [cast.receiver.MediaManager] Resetting media element
   cast_receiver.js:19
   [ 27.579s] [cast.receiver.MediaManager] Sending broadcast status message
   cast_receiver.js:19
   [ 27.581s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"IDLE\",\"currentTime\":0,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false},\"idleReason\":\"FINISHED\"}],\"requestId\":0}"}
   cast_receiver.js:19
  ######### MEDIA ELEMENT ABORT [object Event] sample_media_receiver.html:153
   [ 31.019s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"LOAD\",\"requestId\":28532031,\"sessionId\":\"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69\",\"media\":{\"contentId\":\"http://192.168.0.103/~marco/cast/myimage.jpg\",\"streamType\":\"buffered\",\"contentType\":\"image/jpg\",\"metadata\":null,\"duration\":null,\"customData\":null},\"autoplay\":true,\"currentTime\":null,\"customData\":null}","namespace":"urn:x-cast:com.google.cast.media","senderId":"8:client-68103"}
   cast_receiver.js:19
   [ 31.028s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 8:client-68103]: {"type":"LOAD","requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
   cast_receiver.js:19
   [ 31.031s] [cast.receiver.MediaManager] MediaManager message received [8:client-68103] {"type":"LOAD","requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
   cast_receiver.js:19
   [ 31.033s] [cast.receiver.MediaManager] Dispatching MediaManager load event
   cast_receiver.js:19
  ### Media Manager - LOAD: {"type":"load","B":false,"defaultPrevented":false,"Qa":true,"data":{"requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null},"senderId":"8:client-68103"} sample_media_receiver.html:549
  ### Media Protocol Identified as jpg sample_media_receiver.html:588
  ######### MEDIA ELEMENT LOAD START sample_media_receiver.html:121
  ######### MEDIA ELEMENT ERROR [object Event] sample_media_receiver.html:149
   [ 31.293s] [cast.receiver.MediaManager] Load metadata error
   cast_receiver.js:19
  ### Media Manager - LOAD METADATA ERROR: {"senderId":"8:client-68103","message":{"requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}} sample_media_receiver.html:399
   [ 31.297s] [cast.receiver.MediaManager] Resetting media element
   cast_receiver.js:19
   [ 31.303s] [cast.receiver.MediaManager] Sending error message to 8:client-68103
   cast_receiver.js:19
   [ 31.305s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"8:client-68103","data":"{\"requestId\":28532031,\"type\":\"LOAD_FAILED\"}"}
  </code></pre>
  
  <p>What is wrong?</p>