Fix Edge support - mp3 only for now

master
William Toohey 10 years ago
parent 46662028cb
commit 84e79b9aa9
  1. 24
      src/js/HuesEditor.js
  2. 7
      src/js/SoundManager.js

@ -1225,14 +1225,14 @@ HuesEditor.prototype.drawWave = function() {
this.waveContext.clearRect(0, 0, width, WAVE_HEIGHT_PIXELS);
if(this.buildWave && minTime < 0) {
let bLen = this.core.soundManager.buildLength;
let bLen = this.core.soundManager.buildLength;
if(this.buildWave && bLen && minTime < 0) {
let center = Math.floor((now + bLen) / bLen * this.buildWave.width);
this.drawOneWave(this.buildWave, center, width);
}
if(this.loopWave && maxTime > 0) {
let loopLen = this.core.soundManager.loopLength;
let loopLen = this.core.soundManager.loopLength;
if(this.loopWave && loopLen && maxTime > 0) {
let clampedNow = (minTime % loopLen) + span;
let center = Math.floor(clampedNow / loopLen * this.loopWave.width);
this.drawOneWave(this.loopWave, center, width);
@ -1253,14 +1253,6 @@ HuesEditor.prototype.drawWave = function() {
this.waveContext.stroke();
};
HuesEditor.prototype.alert = function(msg) {
this.statusMsg.classList.remove("fade");
this.statusMsg.textContent = msg;
// Trigger a reflow and thus restart the animation
var useless = this.statusMsg.offsetWidth;
this.statusMsg.classList.add("fade");
};
HuesEditor.prototype.drawOneWave = function(wave, center, width) {
this.waveContext.drawImage(wave,
center - width/2, 0, // source x/y
@ -1269,6 +1261,14 @@ HuesEditor.prototype.drawOneWave = function(wave, center, width) {
width, WAVE_HEIGHT_PIXELS); // dest width/height
};
HuesEditor.prototype.alert = function(msg) {
this.statusMsg.classList.remove("fade");
this.statusMsg.textContent = msg;
// Trigger a reflow and thus restart the animation
var useless = this.statusMsg.offsetWidth;
this.statusMsg.classList.add("fade");
};
HuesEditor.prototype.generateXML = function() {
if(!this.song) {
return null;

@ -67,10 +67,11 @@ SoundManager.prototype.init = function() {
try {
// More info at http://caniuse.com/#feat=audio-api
window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.context = new window.AudioContext();
// These don't always exist
this.context.suspend = this.context.suspend || Promise.resolve;
this.context.resume = this.context.resume || Promise.resolve;
AudioContext.prototype.suspend = AudioContext.prototype.suspend || (() => {return Promise.resolve();});
AudioContext.prototype.resume = AudioContext.prototype.resume || (() => {return Promise.resolve();});
this.context = new window.AudioContext();
this.gainNode = this.context.createGain();
this.gainNode.connect(this.context.destination);
} catch(e) {

Loading…
Cancel
Save