I'm having a problem with mediaelementjs. The player is showing up but when I click on the play button, no audio is playing.
Have you ever experienced this problem?
1 error found in Chrome :
setRules();
reinjectRulesWhenRemoved(document, style);
};
document.addEventListener("error", function(event)
{
checkCollapse(event.target);}, true);
Thanks a lot!
Related
I have a phonegap app, which is now in alpha testing of PlayStore.
The sound works on most devices, but not on Samsung Devices with Android 4.x.
I didn't find an issue or similar questions. Did I do something wrong?
Code with https://github.com/goldfire/howler.js/tree/2.0
var sound = new Howl({
src: ['res/raw/warning.mp3']
}).play();
My code with Cordova-plugin-media:
var src = "res/raw/warning.mp3";
// HTML5 Audio
if (typeof Audio != "undefined") {
new Audio(src).play() ;
// Phonegap media
} else if (typeof device != "undefined") {
// Android needs the search path explicitly specified
if (device.platform == 'Android') {
src = '/android_asset/www/' + src;
}
var mediaRes = new Media(src,
function onSuccess() {
// release the media resource once finished playing
mediaRes.release();
},
function onError(e){
alert("error playing sound: " + JSON.stringify(e));
});
mediaRes.play();
} else {
alert("no sound API to play: " + src);
}
Anyone an idea what is the source of the problem?
There could be a couple of things here; ideally, you should wait for the sound be to loaded before trying to play it (Howler tries to handle this itself, but it doesn't always work)
From their examples
var sound = new Howl({
src: ['sound.webm', 'sound.mp3']
});
// Clear listener after first call.
sound.once('load', function(){
sound.play();
});
The second issue may be because it's an older android device, and thus WebAudio support may be sketchy. Try adding html5 into the options
var sound = new Howl({
src: ['sound.webm', 'sound.mp3', 'sound.wav'],
html5 : true
});
The last issue could be because a lot of mobile devices require a user interaction before they can play a sound (think of browser makers not wanting people to browse to websites and having music automatically start playing!). So once the sound has loaded, request the user to touch the screen once, and then play a sound on that touch event. This should 'unlock' the audio from now on. Again, Howler does try to do this, but it's something you may want to look at as well.
I don't find solution to this problem.
I have tabgroup, on button click I open new window with movie. If I click fullscreen mode button, when I exit from this mode my navigation bar is broken (look attachment).
I have checked all my code but I don't understand what is the problem.
I think that I have this problem from sdk 5.0.0, before it worked fine.
On kitchen sink app works fine, but I'm not able to replicate it on my app.
function Video(_args) {
var self = Ti.UI.createWindow();
var activeMovie = Titanium.Media.createVideoPlayer({
url: _args.url,
backgroundColor:'#111',
mediaControlStyle:Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
self.add(activeMovie);
activeMovie.play();
self.addEventListener('close', function() {
LOG.info("Window closed");
activeMovie.stop();
});
return self;
};
module.exports = Video;
Open movie window
var Video = require('common/Video');
var winVideo = Video({url: videourl});
self.containingTab.open(winVideo);
before fullscreen mode
after fullscreen mode
Best regards
It's a known bug. Check the jira ticket here
I'm trying to catch jPlayer full screen event using the following code:
mainPlayer.bind($.jPlayer.event.resize, function(event) {
alert("size changed");
});
But the event isn't fired neither when I press full screen button nor when I press ESC to exit full screen mode.
Check your mainPlayer variable and make sure it references the jQuery jPlayer object. For troubleshooting, try:
$('#yourJPlayerID').bind($.jPlayer.event.resize, function(event) {
alert("size changed");
});
As demonstrated in the standard jPlayer demo, when the track ends, the player resets time to zero. Is there any way to make it stay at the end of the track?
Use the ended() event in conjunction with the playHead method to keep the play head at the end when it ends.
Modifying the example, here's what I got:
$(document).ready(function() {
$("#jquery_jplayer_1").jPlayer({
ready: function(event) {
$(this).jPlayer("setMedia", {
mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
oga: "http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
});
},
swfPath: "http://www.jplayer.org/2.1.0/js",
supplied: "mp3, oga",
ended : function(){
console.log("ended");
$(this).jPlayer("playHead",100);
}
});
});
JSFiddle: http://jsfiddle.net/wjsKa/2/
Reference: http://jplayer.org/latest/developer-guide/
jPlayer is opensource, so you can tweak code as you desire. I suggest getting jquery.jplayer sources and removing lines 973 and 974 from jquery.jplayer.js. Then you just save your own copy and compress it if you desire to do so.
Or you can play around with _updateInterface method so it doesn't move seek bar when called from "ended" event handler.
Sorry for incomplete answer, can't test it right now.
I want to load sound placed in sounds folder.
Code is
var my_sound = new Sound();
my_sound.loadSound("sounds/sound1.mp3");
my_sound.onLoad = function(success:boolean){
if(success){
my_sound.start();
}
}
This plays sound when flash is open and pressing CTRL+ENTER(Test Movie).
but when we plays the swf it won't play sound.
for this problem i found one solution.
i made off onLoad function. and the Test Movie. Now the opposite things happend.
It dosen't play when press CTRL+ENTER (TestMovie);
but it plays when swf is playing.
Is there any other way of loading sound.
Try:
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean)
{
if (success)
{
my_sound.stop();
}
};
my_sound.loadSound("sounds/sound1.mp3", true);
This will stop the sound as soon as it's loaded.
Whenever you want to start the sound, just call this function:
my_sound.start();