2

I am building a chrome extension that plays a youtube video in the background page with controls for it in an injected content script. I can use play/pause quite effectively using this code:

iframe.contentWindow.postMessage(JSON.stringify({ "event": "command", "func": func, "args": args || [], "id": frame_id }), "*");

My question is how would I receive a response if I were to pass in say getVolume or something similar as my function? Incidentally, is there a better way to do this? Basically I wish for a video to be played in my extension. I could put the video in my content script but then every time a user changes/refreshes a page, the iframe for the video would also be refreshed. Is there a way to display a video in a content script that doesn't refresh with pages or do I have to do it an app?

Thanks in advance, Rohan

Nyx
  • 2,233
  • 1
  • 12
  • 25
  • I'm now looking for the same thing: http://stackoverflow.com/questions/17073962/youtube-player-api-retrieving-a-reference-to-an-existing-player/17076473?noredirect=1#17076473 – arnaud.breton Jun 14 '13 at 00:50

0 Answers0