gpt4 book ai didi

soundmanager2 - 第二期播放

转载 作者:行者123 更新时间:2023-12-04 03:36:35 25 4
gpt4 key购买 nike

我的问题是一旦音轨停止播放并且您第二次按下播放按钮,歌曲就不会播放。我的意思是我听不到任何声音,但第一次工作正常。

 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;
}
});
});

控制台显示:

-- 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

任何帮助都会很棒。

最佳答案

所以我不是 SoundManager2 方面的专家,但我能够修复一个非常像这样的错误。对我来说,这是我的服务器。返回音频数据时需要设置 HTTP header 。

技术说明部分列出了您需要提供的一些基本内容: http://www.schillmania.com/projects/soundmanager2/doc/technotes/

正确设置这些 header 将播放音频。我需要再添加几个标题才能让 SoundManger2 让我播放两次声音。这是我的浏览器获取响应和 mpeg 文件的 header 。我可能需要也可能不需要“Accept-Ranges” header :

Accept-Ranges:bytes
Connection:close
Content-Length:30592
Content-Type:audio/mpeg
Server:Jetty(6.1.x)

关于soundmanager2 - 第二期播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11269613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com