The only one noticeable issue happens when using views/colorbox. If the Video Style is set to autoplay (which would be cool when launching it in colorbox) the sound plays before you actually click the thumbnail preview. I'm guessing that also means the video is loading too. I've only tested Vimeo so far

- mrtalloy from #1336672: Load videos in colorbox.

I'm creating a new issue here so we can work on this separately. My first thought is to create a callback to populate the colorbox when it is opened. Definitely open to options here.

Comments

jdelaune’s picture

Yup it's the issue you get with any lightbox type feature and loading in videos. The only way would be to create a callback like you say and load it in after a click.

jdelaune’s picture

Assigned: jec006 » jdelaune
Status: Active » Needs review
StatusFileSize
new4.06 KB

Here's the patch. Errr wrong one sorry see below.

jdelaune’s picture

StatusFileSize
new3.85 KB

Here's the real patch.

jec006’s picture

This looks good - committed here: http://drupalcode.org/project/video_embed_field.git/commit/d3f844f

Thanks (again) jdelaune

jec006’s picture

Status: Needs review » Fixed
jec006’s picture

I'd like to think about options for getting rid of the use of $_SESSION storage and making it more stateless - I think (though I don't know for sure) that this could become an issue for sites that are using a static cache or something of the nature as the $_SESSION wouldn't be properly populated.

I think the real rub here is that a user should only be able access videos that the site admin has embedded - so simply including the youtube/vimeo id in the link isn't ideal. I was thinking perhaps the id of the entity to which the field is attached, or something along those lines - so it can be loaded again and displayed when the callback is hit?

I think this would be a bit of an invasive change so for right now, I've committed the patch in #3 to fix the main issue. I'd like to ensure that this will work on large scale sites before we release another version of the module though. I'll try to do some work on this soon (hopefully this weekend).

jdelaune’s picture

Yeah I do agree but it was the best solution I could find. I was going to go down the entity id, field name, delta route. This works great when using fields but not if you use an embed code. However the embed code doesn't currently support colorbox either so maybe we say this feature is purely for fields? I was going to work on the embed code next but I'm not sure how else we could do it.

It might be nice to make the embed code depend on a field, a bit like how the insert module works with image field? Then at least we will always have a field to reference. Maybe that's a way forward in the future.

jdelaune’s picture

Also one bug in my previous patch. Line 83 of video_embed_field.module needs to read 'access callback' => TRUE,.

jec006’s picture

Alright, I can fix that. Also thanks for fixing the .info file issues.

Embed codes is a good point, we can think about that - but I agree about the fields.

jec006’s picture

Status: Fixed » Needs review
StatusFileSize
new5.49 KB

Ok, here's a potential solution, wanted to get some feedback before I committed it though.

Basically I added a table to store url/style combinations and then load them for colorbox. It doesn't have any dependence on a field so Embeds should work ok.

The three things I'm semi worried about are:
1. The first view results in a db write - is this is a big deal?
2. Do we need more caching? Is this going to be slow on list pages or some such?
3. Do we need to clean up this table as fields are deleted? Are there other scenarios where we should clean up?

I think cleaning up is potentially a bad idea as the videos may not be stored on a field, or multiple field instances may reference the same video ect. It might actually be a good idea to use a cache table instead of a real table - thoughts?

I tried to add enough caching to make things good, I think perhaps if we need more we should load the whole store, and then cache it, so we only make one database call.

jdelaune’s picture

Looks good. I don't think:

1. Isn't really an issue.
2. We will have to do some tests.
3. It will be tricky as you say. Maybe we could add a manual flush option.

Use of a cache table might be sensible since this is what we are using it for really.

jec006’s picture

Yah, I agree on the cache table thing, I will try to redo using a cache table instead when I get a chance - I'm moving this weekend so I probably won't have time until next week.

jdelaune’s picture

hah ok. Good luck with the move :)

jec006’s picture

StatusFileSize
new4.51 KB

Thanks, i made it ... barely.

So, i did a little bit of refactoring and here's what i've got - this one uses cache_set and get instead of a custom table. Seems to work well, based on my very limited testing.

jec006’s picture

StatusFileSize
new4.45 KB

Durrr, I left a debugging statement in there. here's a new patch.

jec006’s picture

StatusFileSize
new4.39 KB

second durrr - one more, i think i got them all this time.

Take a look - i think this is good and works how we expect.

jec006’s picture

Assigned: jdelaune » Unassigned
Status: Needs review » Fixed
jdelaune’s picture

Works well from my testing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updating link to other issue