There's a Chrome extension called Play To XBMC which adds a little button that will send a YouTube, Vimeo, or CollegeHumor video to XBMC - provided you have the YouTube plugin installed. This is a lot more convenient that using XBMC to search directly, if you don't have a keyboard plugged into the XBMC box.
The XBMC iPlayer plugin suffers from the same problem that browsing/searching aren't easy without a keyboard, so I wondered if I could make a chrome extension that would do the same for iPlayer.
Chrome extensions are packages of javascript, html, and image files that get unpacked by Chrome when they're installed. You make a Manifest file (which is a JSON file) that tells Chrome what icons to include, what sort of package it is, etc. The Play To XBMC extension is a browser one - the button is always there. I made mine page specific - it only appears on valid iPlayer episode pages. You do this by putting in a javascript page that runs in the background every time a tab is refreshed. My one identifies the url by looking for "/iplayer/episode/".
Then I stole the innards from the other extension. It uses LocalStorage to hold the password, etc., and a jQuery ajax request to send the JSON-RPC commands to xbmc. To add an iPlayer episode you add to the playlist the url: "plugin://plugin.video.iplayer/?pid=<8 character program id>", then cause the player to open and start the playlist.
Problem: The first AJAX command in a group would go off, the others never.
Solution: I was triggering the functions from onclick eventlisteners on links, but it seems to be incredibly difficult to consume the event completely so that the link doesn't trigger - which it was doing, causing the page to refresh and the javascript to stop running. I replaced the links with spans - I'll just make them look like links with CSS, I guess.
Problem: The site is always returning 401, even when you log in with the correct password.
Solution: You need to explicitly ask for permission to access sites using the manifest.json (adding "http://*/" to the permissions array). This is what signals Chrome to allow posting and sending basic authentication information to a site that isn't the site of origin (which an extension doesn't have, since it's running in the browser).
Problem: XBMC plays the first second or two of the playlist, then exits. It appears that moving a video onto the playlist works well. You can manually start it from the playlist and everything works fine. But starting it from the JSON-RPC command doesn't work - it just exits after a second or two, leaving the file on the playlist. The Play to XBMC extension doesn't seem to have this problem, and I can't work out what's different.
Solution: None yet.
The XBMC iPlayer plugin suffers from the same problem that browsing/searching aren't easy without a keyboard, so I wondered if I could make a chrome extension that would do the same for iPlayer.
Chrome extensions are packages of javascript, html, and image files that get unpacked by Chrome when they're installed. You make a Manifest file (which is a JSON file) that tells Chrome what icons to include, what sort of package it is, etc. The Play To XBMC extension is a browser one - the button is always there. I made mine page specific - it only appears on valid iPlayer episode pages. You do this by putting in a javascript page that runs in the background every time a tab is refreshed. My one identifies the url by looking for "/iplayer/episode/".
Then I stole the innards from the other extension. It uses LocalStorage to hold the password, etc., and a jQuery ajax request to send the JSON-RPC commands to xbmc. To add an iPlayer episode you add to the playlist the url: "plugin://plugin.video.iplayer/?pid=<8 character program id>", then cause the player to open and start the playlist.
Problem: The first AJAX command in a group would go off, the others never.
Solution: I was triggering the functions from onclick eventlisteners on links, but it seems to be incredibly difficult to consume the event completely so that the link doesn't trigger - which it was doing, causing the page to refresh and the javascript to stop running. I replaced the links with spans - I'll just make them look like links with CSS, I guess.
Problem: The site is always returning 401, even when you log in with the correct password.
Solution: You need to explicitly ask for permission to access sites using the manifest.json (adding "http://*/" to the permissions array). This is what signals Chrome to allow posting and sending basic authentication information to a site that isn't the site of origin (which an extension doesn't have, since it's running in the browser).
Problem: XBMC plays the first second or two of the playlist, then exits. It appears that moving a video onto the playlist works well. You can manually start it from the playlist and everything works fine. But starting it from the JSON-RPC command doesn't work - it just exits after a second or two, leaving the file on the playlist. The Play to XBMC extension doesn't seem to have this problem, and I can't work out what's different.
Solution: None yet.
Comments
Post a Comment