Smugmug API Issues (mostly around video embed codes)
winston
Registered Users Posts: 19 Big grins
Hi,
I'm trying to write an emfield video provider for Drupal. There are a couple of issues I'm stumbling upon that I was hoping to get some discussion around.
1. smugmug.Images.GetInfo provides me with direct links to various video sizes, but I don't see any way to get the embed codes programmatically.
2. # 1 would not be an issue if the embed codes provided a way for me to just programatically insert the video URI myself. Here is an example embed code...
[html] <object width="425" height="288"><param name="movie" value="http://cdn.smugmug.com/ria/ShizVidz-2008120101.swf" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="s=ZT0xJmk9NTMyMDk4MzIxJms9QURURjUmYT04MTU0MjUwXzVtZkNwJnU9YmxhY2trbmlnaHRz" /><embed src="http://cdn.smugmug.com/ria/ShizVidz-2008120101.swf" flashVars="s=ZT0xJmk9NTMyMDk4MzIxJms9QURURjUmYT04MTU0MjUwXzVtZkNwJnU9YmxhY2trbmlnaHRz" width="425" height="288" type="application/x-shockwave-flash" allowFullScreen="true"></embed></object>
[/html]
Some additional questions...
Are there undocumented options to the embed codes that would allow me to get around this? For example if I could just put videourl="url" the same way the above embed code has allowFullScreen="true" then #2 wouldn't be a problem.
This is my biggest problem writing this provider for Drupal right now.
A smaller issue is that since the embed code does not have the imageid and imagekey anywhere, there is no way for me to allow a user of my site to copy and paste the embed code such that I can extract the imageid and imagekey for further api usage. The way the Drupal embedded video field module works with all other providers it is allows the user to copy _either_ the URL to the video page, OR the embed code and paste it into a field. But then embedded video field extracts the appropriate ids and calls the api for the provider to get needed information which gives MUCH more power to the Drupal site designer as far as presentation as well as more power to the user in not having to understand links or embed codes. So, is there any way that you could add imageid and imagekey into the actual embed code to parse? Or is there perhaps some way I can extract imageid and imagekey from flashVars="s=ZT0xJmk9NTMyMDk4MzIxJms9QURURjUmYT04MTU0MjUwXzVtZkNwJnU9YmxhY2trbmlnaHRz"
Drupal is a VERY heavily used CMS, probably right behind Joomla in usage and growing. I would also say Drupal is used by some pretty large websites due to its extensible nature. I'd definitely love to make it easy for Drupal folks to use Smugmug on their Drupal sites. I've been successful in making this work for images, but right now the only way I can make it work for video is to not allow users to paste embed codes AND to use only a third party flash video player.
Thanks for any comments/feedback.
I'm trying to write an emfield video provider for Drupal. There are a couple of issues I'm stumbling upon that I was hoping to get some discussion around.
1. smugmug.Images.GetInfo provides me with direct links to various video sizes, but I don't see any way to get the embed codes programmatically.
2. # 1 would not be an issue if the embed codes provided a way for me to just programatically insert the video URI myself. Here is an example embed code...
[html] <object width="425" height="288"><param name="movie" value="http://cdn.smugmug.com/ria/ShizVidz-2008120101.swf" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="s=ZT0xJmk9NTMyMDk4MzIxJms9QURURjUmYT04MTU0MjUwXzVtZkNwJnU9YmxhY2trbmlnaHRz" /><embed src="http://cdn.smugmug.com/ria/ShizVidz-2008120101.swf" flashVars="s=ZT0xJmk9NTMyMDk4MzIxJms9QURURjUmYT04MTU0MjUwXzVtZkNwJnU9YmxhY2trbmlnaHRz" width="425" height="288" type="application/x-shockwave-flash" allowFullScreen="true"></embed></object>
[/html]
Some additional questions...
Are there undocumented options to the embed codes that would allow me to get around this? For example if I could just put videourl="url" the same way the above embed code has allowFullScreen="true" then #2 wouldn't be a problem.
This is my biggest problem writing this provider for Drupal right now.
A smaller issue is that since the embed code does not have the imageid and imagekey anywhere, there is no way for me to allow a user of my site to copy and paste the embed code such that I can extract the imageid and imagekey for further api usage. The way the Drupal embedded video field module works with all other providers it is allows the user to copy _either_ the URL to the video page, OR the embed code and paste it into a field. But then embedded video field extracts the appropriate ids and calls the api for the provider to get needed information which gives MUCH more power to the Drupal site designer as far as presentation as well as more power to the user in not having to understand links or embed codes. So, is there any way that you could add imageid and imagekey into the actual embed code to parse? Or is there perhaps some way I can extract imageid and imagekey from flashVars="s=ZT0xJmk9NTMyMDk4MzIxJms9QURURjUmYT04MTU0MjUwXzVtZkNwJnU9YmxhY2trbmlnaHRz"
Drupal is a VERY heavily used CMS, probably right behind Joomla in usage and growing. I would also say Drupal is used by some pretty large websites due to its extensible nature. I'd definitely love to make it easy for Drupal folks to use Smugmug on their Drupal sites. I've been successful in making this work for images, but right now the only way I can make it work for video is to not allow users to paste embed codes AND to use only a third party flash video player.
Thanks for any comments/feedback.
0
Comments
In my next release of the API, I was considering adding some more video friendly features, would returning the embed code in the getInfo call sort this out for you ?
Cheers,
David
SmugMug API Developer
My Photos
Hey David,
Thanks for the quick response. This will be a long post as I can't succintly describe my problem. I do hope you'll help as I really do want smugmug to be well represented as a provider for drupal sites. There are probably hundreds of thousands of drupal sites out there and drupal has been taking off for quite some time as a popular CMS.
In direct response, putting the embed code(s) in the getInfo response isn't really what I would ask for. If you did it I might be able to use it, but it isn't what would really help me. I'm thinking it would also almost double the size of the xml response yes?
It might help if I explain the module I'm integrating with. Here is a link to the module page on drupal.org.
http://drupal.org/project/emfield
and the module I'm working on adds a new provider (smugmug of course!) to the list of supported providers (ideally both for images and video) and it is here...
http://drupal.org/project/media_smugmug
The emfield (embedded media field) module is designed to integrate with the Drupal content construction kit module. Basically, in drupal you would create a new content type (let's say a blog type with a lead image field just to keep it simple for now). In this new content type you would create a new field of type "embedded image field" to be used for your lead image. When you configure this new field you would select which image providers you want to support. Right now flickr, imageshack, photobucket, and I believe picasa are supported image providers. Now if I were to keep all my images offsite in smugmug I would just want to select that. If I were running a public blog site or some such perhaps I'd want to support more than one service, etc.
So once I've set this content type up, from the user perspective embedded media fields always work the same. The user copies the URL of the item they want to embed from the provider site, or they may also copy the embed code from a video site if it were an embedded video field. Under the hood the provider include is called by emfield. In fact, emfield calls the provider code for all the providers you selected for that field to support so the user may in theory be pasting a smugmug image one time and a picasa image the next and in theory the emfield provider code should pick those up just fine. The provider may in turn call the api of the provider to get any additional needed information, etc. The goal is to provide as much power to the designer/themer of the drupal site while providing a fairly consistent way to get external content.
So for images the current module I've created works well. A site designer can easily use my module to add smugmug as a provider. And my module works with almost any URL they can fish up for an image from your site (either straight from the address bar or from the get links page). So that is no problem.
For video on the other hand it is much more of a problem. For copy and paste to the embedded video field - URLs from smugmug work fine because I can extract the imageid and key. But embed codes from smugmug have no imageid or key so they fail here. The Embedded video field drupal module expects that the user will be able to use either a URL to the video page OR the embed code at which point it will extract the needed identifier from either/or and proceed from there. So this is a problem on the aquisition side of things (when the user of the site is trying to create a new item).
On the display side of things it is also a problem. Since the embed code is readily available on most provider sites and includes a link to the item using the identifier it is fairly easy for the developer of the provider to just use that so in most cases there is not much value for retrieving the embed code through the API of the provider as it is just as simple to manipulate in the module for most providers. In fact if the embed code includes parameters that are well documented and easy to figure out (autoplay, backgroundcolor, thumbnaillink, etc.) then the provider code can even provide theming options for the site designer that leverage that.
So to summarize, I'm in pretty good shape writing the image provider for smugmug. I'm happy with that. However for writing the video provider I have the following issues...
1. No way to extract the imageid and imagekey from the embed code. This creates a break in user expectations and experience in comparison to all other embedded video field providers.
2. No well documented options for the embed code to allow the site designer on the receiving end to customize the result. This results in my not being able to output the embed code for an item programmatically, which in turn forces me to not be able to use the smugmug flashplayer
3. The api DOES give me a way to get the link to the video (for example Video640URL from the getInfo call). With this I am therefore able to retrieve an actual URI to a video file and provide that to ANOTHER flashplayer (such as Flowplayer)! But since your flashplayer embed code has no way for me to use that direct link (or the imageid and imagekey for that matter) I CANNOT use the smugmug flashplayer on the display side in my code!
So right now I'm left with a video provider that would work as follows:
1. User would have to pick the URL to the video NOT the embed code to pasted into the embedded video field
2. The provider code would use that to extract imageid and imagekey and through the api get the desired video link (Video640URL for example)
3. Finally, on the display side, my provider would have to use SOME OTHER flashplayer than the smugmug flashplayer (for example flowplayer). This would be necessary because there is no way to insert the Video640URL from the smugmug api into the smugmug embed code!
So perversely the only way I can get embedded video field to work the way it does for every other video provider is to provide special instructions NOT to use the embed code for pasting into the field, and on the display side to go out of my way not to use the smugmug player.
I would much prefer that my provider use the smugmug flashplayer by default (it's a nice player!). I would also prefer that smugmug not be the only video provider where the embed code from your site won't work as a copy and paste into the embedded video field.
The ideal solution would allow the following:
1. You embed code include the imageid and imagekey in it somewhere so I can parse it out in my code.
2. Your embed code or flashplayer options provide some way for me to either provide the direct URL to the video file obtained through the getInfo api call. OR, if you prefer, your flashplayer/embed code support a URL to the item in a specific format (something like http://smugmug.com/photos/555555555_a56j3-640 or some such)
3. As an alternative to 2, you COULD also add a new api call that allows me to supply an imageid and imagekey. Perhaps smugmug.Images.getEmbedCodes. This could return embed codes ready to go for each video size available for this video item. This option may be preferable to you if you are really trying to avoid putting imageid/key into the embed code itself. I would personally prefer option 2, but understand that if your flashplayer has specific limitations then it might be harder to change that than just providing a new api call.
Happy to discuss further. Sorry for the long post.
- Peter
It would be helpful as I could then return that to the user.
Thanks,
Winston
G'day Winston,
We now support oEmbed, which returns the embed code for videos...perhaps that would work for you ?
More info here.
Cheers,
David
SmugMug API Developer
My Photos
http://api.smugmug.com/services/oembed/?url=http://blackknights.smugmug.com/Marching-Band/Video-2010/10084118_DLjY6#692056563_Vo9kM
Above link doesn't return anything helpful. Is it contrained to s specific format (something I can construct if I know the gallery and item id)?
you need to url encode the url parameter, otherwise the hash doesn't get passed..
http://api.smugmug.com/services/oembed/?url=http%3A%2F%2Fblackknights.smugmug.com%2FMarching-Band%2FVideo-2010%2F10084118_DLjY6%23692056563_Vo9kM
SmugMug API Developer
My Photos
Very impressed that it even supports the "maxheight" parameter so I can get back a different sized player!
Thanks!
URL: http://blackknights.smugmug.com/Marching-Band/Video-2010/10084118_DLjY6#692056563_Vo9kM
FILENAME: Video1234
and has a button [CREATE]
and this button outputs a Video1234.html with the <html.>embed</html.> and saves it in the same directory as the script/php, given that it has the correct CHMOD?