My problem is once the audio track stops playing and you go to hit the play button for a second time, the song just doesn't play. By this i mean i don't hear anything playing but the first time works fine.
soundManager.url = '{{ asset('bundles/bm/swf/')}}';
soundManager.onload = (function() {
var preview = soundManager.createSound({
id: 'previewer',
url: '{{ path('play_track', { 'id' : track.id}) }}',
type: 'audio/mp3'
});
preview.options.whileplaying = function() {
var current = new Date (this.position),
minutes = current.getMinutes(),
seconds = current.getSeconds();
var current = minutes + ':' + seconds;
$('.editable').html(current);
}
$('.bigPlay').click(function(e){
if($(this).hasClass('playbtn')) {
e.stopPropagation();
$(this).removeClass('playbtn').addClass('pausebtn');
preview.play({
onfinish: function() {
preview.stop();
$('.bigPlay').removeClass('pausebtn').addClass('playbtn');
}
});
return false;
}
if($(this).hasClass('pausebtn')) {
e.stopPropagation();
$('.bigPlay').removeClass('pausebtn').addClass('playbtn');
preview.stop();
return false;
}
});
});
The console shows:
-- SoundManager 2: HTML5 support tests (/^(probably|maybe)$/i): mp3: true (preferring flash), mp4: true (preferring flash), ogg: true, wav: true -- soundmanager2.js:1110
-- SoundManager 2 V2.97a.20120527 (AS2/Flash 8) + HTML5 audio, normal polling -- soundmanager2.js:1110
soundManager::createMovie(): Trying to load /bundles/bm/swf/soundmanager2_debug.swf soundmanager2.js:1110
soundManager::initMovie(): Waiting for ExternalInterface call from Flash... soundmanager2.js:1112
soundManager::externalInterfaceOK() (~0 ms) soundmanager2.js:1112
soundManager::init() soundmanager2.js:1112
soundManager: Attempting JS to Flash call... soundmanager2.js:1112
(Flash): SM2 SWF V2.97a.20120527 (AS2/Flash 8) soundmanager2.js:1112
(Flash): JS to/from Flash OK soundmanager2.js:1112
Flash security sandbox type: remote soundmanager2.js:1112
(Flash): Enabling polling, 50 ms interval soundmanager2.js:1112
-- SoundManager 2 loaded (OK) -- soundmanager2.js:1110
soundManager::initComplete(): calling soundManager.onload() soundmanager2.js:1110
soundManager.createSound(): previewer (/app_dev.php/track/play/4.mp3) soundmanager2.js:1110
SMSound() merged options: {
id: previewer,
url: /app_dev.php/track/play/4.mp3,
type: audio/mp3,
autoLoad: false,
autoPlay: false,
loops: 1,
multiShot: true,
multiShotEvents: false,
pan: 0,
stream: true,
usePolicyFile: false,
volume: 100
} soundmanager2.js:1112
Loading sound previewer via HTML5 soundmanager2.js:1112
creating HTML5 Audio() element with URL: /app_dev.php/track/play/4.mp3 soundmanager2.js:1112
HTML5::adding event listeners: previewer soundmanager2.js:1112
SMSound.load(): /app_dev.php/track/play/4.mp3 soundmanager2.js:1110
HTML5::load: previewer soundmanager2.js:1112
0 soulshaka-club-69-underground-mix:529
soundManager.onload() complete soundmanager2.js:1110
HTML5::loadstart: previewer soundmanager2.js:1112
SMSound.play(): "previewer" is loading - attempting to play.. soundmanager2.js:1110
SMSound.play(): "previewer" is starting to play soundmanager2.js:1112
setPosition(0): delaying, sound not ready soundmanager2.js:1112
HTML5::play: previewer, /app_dev.php/track/play/4.mp3 soundmanager2.js:1112
HTML5::waiting: previewer soundmanager2.js:1112
HTML5::loadedmetadata: previewer soundmanager2.js:1112
HTML5::loadeddata: previewer soundmanager2.js:1112
SMSound._onload(): "previewer" loaded. soundmanager2.js:1110
HTML5::canplay: previewer, /app_dev.php/track/play/4.mp3 soundmanager2.js:1112
HTML5::playing: previewer soundmanager2.js:1112
HTML5::suspend: previewer soundmanager2.js:1112
HTML5::suspend: previewer soundmanager2.js:1112
HTML5::suspend: previewer soundmanager2.js:1112
HTML5::suspend: previewer soundmanager2.js:1112
HTML5::ended: previewer soundmanager2.js:1112
SMSound._onfinish(): "previewer" soundmanager2.js:1112
SMSound.play(): "previewer" soundmanager2.js:1112
SMSound.play(): "previewer" is starting to play soundmanager2.js:1112
setPosition(0): setting position soundmanager2.js:1112
HTML5::play: previewer, /app_dev.php/track/play/4.mp3 soundmanager2.js:1112
HTML5::playing: previewer soundmanager2.js:1112
setPosition(0): setting position soundmanager2.js:1112
SMSound.play(): "previewer" soundmanager2.js:1112
SMSound.play(): "previewer" is starting to play soundmanager2.js:1112
setPosition(0): setting position soundmanager2.js:1112
Any help would be great.
So I'm no expert in SoundManager2, but I was able to fix a bug that acted a lot like this. For me it was my server. There are HTTP headers you need to set when returning the audio data.
The technical notes section lists out some basic things you need to provide:
http://www.schillmania.com/projects/soundmanager2/doc/technotes/
Getting those headers right will get the audio playing. I needed to add a couple more headers just to get SoundManger2 to let me play the sound twice. Here are the headers from the response of my browser fetching and mpeg file. I may or may not need the "Accept-Ranges" header:
Accept-Ranges:bytes
Connection:close
Content-Length:30592
Content-Type:audio/mpeg
Server:Jetty(6.1.x)
Related
I'm playing an audio through the ngCordova media plugin using the seekTo method:
media.play();
media.seekTo(time);
In iOS, the audio plays from the beginning instead of moving the position within the audio file while the first time playing. It only works if I delay the seekTo:
media.play();
setTimeout(function () {
media.seekTo(time);
}, 500);
However, this is not reliable and I want to check by Media.MEDIA_RUNNING status instead, which seems this callback is missing in ngCordova.
Probably you are entering time into seconds.
Try
media.seekTo(time * 1000);
How can I set a poster image using particular video frame (flv)?
I don't have image file available, so I wonder if it's possible to set a poster image "in the fly" from the video source.
No, that's not possible with JW Player.
Edit: A little more explanation.... JW Player doesn't actually "play" or "process" the video in any way. It's just a steering and styling script - it feeds the video to the browser's <video> tag if the browser can handle it, or to the Flash plugin. The player provides its own control bar, advertising capabilities, and so on, but when it comes to the video file itself, the player isn't touching it. So, there's no way to do things like extracting certain frames. The player isn't ffmpeg.
Here is a little bit of a hack you can use:
<div id="myElement"></div>
<script>
jwplayer("myElement").setup({
file: "/uploads/myVideo.mp4",
autostart: true,
mute: true,
controls: false
});
</script>
<script>
setTimeout(function() {
jwplayer().pause();
jwplayer().setMute(false);
jwplayer().setControls(true);
},3000);
</script>
What this does is basically autostarts the player, muted, with no controls, then after a second, pauses the player, and sets the controls and volume back. Essentially it is grabbing the first frame. Keep in mind this is a bit of a hack and isn't great for bandwidth.
How to handle keydown events for Samsung SmartTV SEF Player (link)?
I tried:
Markup:
<object id="pluginObjectPlayer" border=0 classid="clsid:SAMSUNG-INFOLINK-PLAYER" style="position:absolute;z-index:1;left:0px;top:0px;width:1280px;height:720px"></object>
Code:
var player = document.getElementById('pluginObjectPlayer'); //get player object
player.Play(streamUrl); //start playback
$("body").focus(); //focus on html element which can handle keydown events
Doesn't works. Playback starts normally, but keydown event is not handled.
SEF Player doesn't have any event key handlers, the key event will catched by the scene/main javascript code and need to do the action by code with the player API. For example to stop the playback :
case sf.key.STOP:
player.Stop();
break;
For Youtube player I can set start and end time parameters which will crop video in this range. How can I do the same thing using Vimeo player?
Vimeo JavaScript API: seekTo(seconds:Number):void and pause():void after some progress.
Vimeo ActionScript API:
seek(seconds:Number):void and pause():void after some progress.
Also basic link parameter from this Help Center article: vimeo.com/148198462#t=1m5s Stopping the video at the particular time in this case isn't implemented yet.
I was able to solve it using "setCurrentTime" for set the start of the video, and 'timeupdate' for set the end.
For the start of the video at a specific time:
Player.setCurrentTime(5);
The video will start after 5 seconds.
For the end of video:
video01Player.on('timeupdate', function(data) {
if (data.seconds > '10') {
video01Player.pause();
}
});
In this case the video will pause after 10 seconds.
timeupdate
This event fires when the playback position of the video changes, generally every 250 ms during playback, but the interval can vary depending on the browser.
I have a working webview in Titanium with an embeded youtube video. The video plays nice, I can stop it, resume it and so on. But when the video plays to the end and I press "done". The webview goes black with the text: YouTube. Nothing else. I would like there to be the same thumb and playbutton as before I played the video.
My embeded code looks like this:
html:'<html><head></head><body style="margin:0"> <embed id="yt" src="'+tubeURL+'" type="application/x-shockwave-flash" width="150" height="113"></embed></body></html>',
I've googled this problem for days now. I hope someone can help me here.
Cheers
//Martin
EDIT: This solved it. Put &controls=1&rel=0 in the end of the URL.
YouTube players can be embedded in a web page using either an < iframe> tag or an < object> tag.
By appending parameters to the SWF or IFrame URL, you can customize the playback experience in your application. For example, you can automatically play videos using the autoplay parameter or cause a video to play repeatedly using the loop parameter or in your case hide or show controls.
controls
Values: 0, 1, or 2. Default is 1. This parameter indicates whether the video player controls will display. For AS3 players, it also defines when the Flash player will load:
controls=0 – Player controls do not display in the player. For AS3 players, the Flash player loads immediately.
controls=1 – Player controls display in the player. For AS3 players, the Flash player loads immediately.
controls=2 – Player controls display in the player. For AS3 players, the Flash player loads afer the user initiates the video playback.
The correct answer for your question would be controls=2.
SOURCE INFO: https://developers.google.com/youtube/player_parameters#controls