-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Element not working in production #30
Comments
Hmm, seems very odd. Can you post the version of rails you are using, your application.js manifest, the code you are using to attempt to run mediaelement on a jQuery object, and generally any more background you can give me? |
Yep, of course. //= require jquery
//= require jquery_ujs
//= require jquery.cookie
//= require underscore
//= require foundation
//= require froogaloop
//= require mediaelement_rails/rails
//= require mapbox
//= require_tree . The jQuery object looks like this (the error callback was only added to see if that could make a difference): var players = $('.background-video video').mediaelementplayer({
features: [],
enableKeyboard: false,
enablePluginDebug: true,
loop: false,
success: function (mediaElement, domObject) {
if ( mejs.MediaFeatures.isiOS ) {
$('.mejs-layers, .mejs-controls').hide();
}
window.mediaElement = mediaElement;
window.domObject = domObject;
mediaElement.addEventListener('ended', function () {
// mediaElement.setCurrentTime(parseFloat($(domObject).attr('data-rewindto')));
var time = parseFloat($(domObject).attr('data-rewindto'));
// mediaElement.setCurrentTime(15.13); // #hack: should come from the a data-attribute
mediaElement.play();
mediaElement.setCurrentTime(time);
}, false);
mediaElement.addEventListener('canplay', function () {
mediaElement.play();
mediaElement.setVolume(0);
}, false);
mediaElement.addEventListener('play', function () {
var backgroundEl = $(domObject).parents().find('.background-inner');
backgroundEl.find('.waiting-background, .fallback-background').css('display', 'none');
backgroundEl.find('.mejs-video').css('display', 'block');
}, false);
console.log(mediaElement, domObject);
},
error: function () {
console.log('error 123');
}
}); Let me know if there's more background you need from me :) |
i'm trying to fix this myself. Anyone has any pointers? In my case, i believe it is a crossdomain issue which is preventing it to play in prod. Here are some reference research i stumble into: Apparently i need to add a file to crossdomain.xml:
i'm still figuring it out myself since it is still not working. |
There's a separate swf file meant for cdn usage, I haven't looked into how it works and integrates with this gem. You could try uploading that to your s3 and see if it works for you. |
oh i notice my current video is trying to play using the "flashmediaelement.swf".
|
Mark, u da' man! :- ) |
Yeah, I plan to better integrate that cdn-capable swf into the gem and the Glad I was able to help! On Mon, Aug 4, 2014 at 10:03 PM, Thomas notifications@github.com wrote:
|
the latest version that just got release 2.15.0 2 days ago i believe have a bad cdn |
I'm using the gem, and it works smooth in development, but whenever I switch to production it doesn't work. Neither the success nor failure callback is fired when attaching it to a jquery element, however it also doesn't give an error. Messing with the options for how the JS-file is compiled it seems it's related to the compilation and combining of the javascript file, however this doesn't seem to make much sense.
Is this a common error, or what could have caused it?
The text was updated successfully, but these errors were encountered: