mirror of
https://github.com/mrkite/soundsmith.git
synced 2024-12-26 12:29:18 +00:00
fixed safari support
This commit is contained in:
parent
05a3571ede
commit
0f5bcc71ef
7
fta.js
7
fta.js
@ -233,10 +233,13 @@ var FTAPlayer = (function () {
|
|||||||
FTAPlayer.prototype.play = function () {
|
FTAPlayer.prototype.play = function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
try {
|
try {
|
||||||
this.ctx = new AudioContext();
|
this.ctx = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
|
if (this.ctx == undefined) {
|
||||||
|
throw new Error("No audio support!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
alert('No audio support');
|
alert(e.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
||||||
|
7
smith.js
7
smith.js
@ -250,10 +250,13 @@ var Player = (function () {
|
|||||||
Player.prototype.play = function () {
|
Player.prototype.play = function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
try {
|
try {
|
||||||
this.ctx = new AudioContext();
|
this.ctx = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
|
if (this.ctx == undefined) {
|
||||||
|
throw new Error("No audio support!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
alert('No audio support');
|
alert(e.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
||||||
|
@ -68,9 +68,12 @@ class FTAPlayer {
|
|||||||
|
|
||||||
public play(): void {
|
public play(): void {
|
||||||
try {
|
try {
|
||||||
this.ctx = new AudioContext();
|
this.ctx = new ((<any>window).AudioContext || (<any>window).webkitAudioContext)();
|
||||||
|
if (this.ctx == undefined) {
|
||||||
|
throw new Error("No audio support!");
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert('No audio support');
|
alert(e.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
||||||
|
@ -85,9 +85,12 @@ class Player {
|
|||||||
|
|
||||||
public play(): void {
|
public play(): void {
|
||||||
try {
|
try {
|
||||||
this.ctx = new AudioContext();
|
this.ctx = new ((<any>window).AudioContext || (<any>window).webkitAudioContext)();
|
||||||
|
if (this.ctx == undefined) {
|
||||||
|
throw new Error("No audio support!");
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert('No audio support');
|
alert(e.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
this.audioNode = this.ctx.createScriptProcessor(0, 0, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user