AFAIK the current onebox implementation works with urls of the form: YouTube
This form of the URL accepts limited player parameters while alternate forms offer a much bigger parameter list that can come in very handy (better playlist control, branding, looping, etc). I am not competent to modify the existing onebox implementation without help. Any thoughts on how tough it would be to support these alternate forms?
Yes - those functions are supported but there are a bunch more options available with the other forms of the URL that are of value. The official Google docs list all of them, and most are not available with the /watch form of the URL.
The ones we care about are:
autohide (for the controls)
rel (to enable/disable related videos)
showinfo (title information display)
The challenge we have is that on our YouTube channel it is beneficial to have videos in a playlist that will automatically roll from one to the next. Within the forum this behavior is NOT desirable - we want to stop after playing 1 video and discuss it. The rel= parameter lets us accomplish that, but it is not available with the /watch form of the URL, and the other YouTube URLs don’t onebox correctly.
OK, so never having written a line of Ruby in my life, would adding something like this at line 81 get the job done? Then I need to figure out how to make this a plugin? About time I learned how …
Yes - this is the brain-dead way of doing it. Creating an array of parameters of interest and looping through it would be nicer. Whatever the correct Ruby syntax is for something like this:
@codinghorror - We would rather host with you than at Amazon. A couple things block us:
I don’t think we can use the locale-override plugin if we host with you. The customized strings are important to us.
We are integrated with a SquareSpace front end and use the Discourse API from SquareSpace, requiring a custom X-Frame-Options setting to allow cross-domain operation. We use the API to create new topics from a simple box (less confusing than the markdown editor for a certain class of users). We also plan to use the API to extract recent posts related to videos.
If I am wrong about these items we would gladly become a customer.
@riking - Having never created a PR and being a complete novice with Ruby I’ll probably screw something up. You are forewarned.
@sam and @riking - Being able to submit a PR means:
executing the Discourse Contributor Agreement (not a problem)
setting up a Discourse Development Environment that actually works
Making the change
Testing it
Submitting the PR
All of this is good stuff that I have been putting off for months and will try to get done in the next day or two. If I fail, then please feel free to grab this code and insert it the right way. My biggest blocker right now is understanding exactly how to deploy the modified file on to my Discourse instance. I have no idea how to add the modified “onebox” code back into Discourse. As it is approaching 1AM, it will wait until later today …
Go for it. a custom onebox is a good place to start i.e.
Save a file whatever_name_onebox.rb in the lib/onebox/engine folder
module Onebox
module Engine
class WhateverNameOnebox
include Engine
matches_regexp /^http:\/\/www\.domian\.com\/forums\/.*/
def to_html
"<iframe src='#{@url}' style='border-width:0' frameborder='0' scrolling='no' width='100%'></iframe>"
end
end
end
end
Regex might be tricky, and I hope you have better design skills than I do, but this will hopefully give you a starting point.
* my iframe line is a single but it got crunched here.