Hi, I need to know how to render an instance of the MediaElement with only a $file->fid value. I'm trying to work around the issues that having multiple video sources brings. We're using the Media module, and I've got mp4's from a CDN, youtube links and other providers too. It isn't ideal, but our content is in a bunch of places.

I have a filefield: field_video which allows unlimited values. I'm working on a page callback function that will render an instance of the MediaElement player and am having trouble working out the code.

Basically, I have the initial page loading the drupal_render(ed) first value of the field_video--and all of the other field values listed underneath (a playlist). Each playlist item is given a javascript click event which passes the "fid" of the video to a page callback function so as to render the player with the new video file in it. Then, I'm using jquery's .load() function to grab the rendered player and stick it into the initial player div (replacing the player that was loaded when the original node was rendered).

I can't really seem to get the second instance of the player to show up, unless I put "return theme('mediaelement_video', $variables);" at the end of the callback function. This, however, loads in all of the javascripts, css files, etc for the page and takes way too long.

In looking through this, I guess I have two main questions:

1. Can I render a new instance of MediaElement dynamically // how? Or is there someone who could explain how "setSrc" might work with the MediaElement module's render functions?

2. in mediaelement.js on line 9, is it possible that instead of "$.each" it should be $('*').live? Although I've tried this and not had luck, I'm wondering whether this change would take into account new instances of the mediaelement player that are created after the DOM is initially built/rendered.

Thanks for any help or directions...

Comments

dellis’s picture

Issue summary: View changes

sp

jnettik’s picture

Status: Active » Closed (outdated)

Old ticket. Closing.