是否有可能创建具有多个曲目同时播放JavaScript的音频播放器? [英] Is it possible to create javascript audio player with multiple tracks playing in same time?

查看:189
本文介绍了是否有可能创建具有多个曲目同时播放JavaScript的音频播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用10的声音,例如创建自定义播放器。所有10首曲目是一首音乐组合物的成分,通过不同的乐器创建。

I want to create custom player with 10 sounds for example. All 10 tracks are components of one music composition, created by different instruments.

有关我想有开​​/关切换每个轨道。单击每个切换器的声音将发挥后。

For each track I want to have on/off switcher. After clicking each switcher sounds will play.

接通所有按钮所有轨道具有后在同一时间进行播放。

After turning on of all buttons all tracks have to be played in the same time.

每个赛道都完成后必须一再重复。是否有可能不使用闪光灯使这个?

Each track have to be repeated again and again after finishing. Is it possible to make this without flash?

这是例子这个任务,在动作脚本创建的: http://www.incredibox.com/ EN /播放#

This is example of this task, created in ActionScripts: http://www.incredibox.com/en/play#

谢谢!

推荐答案

使用HTML5的JavaScript API的音频,你可以为你喜欢实例尽可能多的音频对象:

Using the HTML5 javascript audio API, you can instantiate as many audio objects as you like:

var soundOne = new Audio('sound1.ogg'),
    soundTwo = new Audio('sound2.ogg'),
  soundThree = new Audio('sound3.ogg');
// etc.

您可以接着玩和编程方式阻止他们。例如。 soundOne.play();

You can then play and stop them programatically. E.g. soundOne.play();

查看 https://developer.mozilla.org/ EN-US /文档/网页/ HTML /元/音频

有关循环,有一个循环的指令,但它没有得到广泛的支持。看看这个对周围的工作SO文章: HTML 5音频环接

For looping, there is a loop directive, but it's not widely supported. Check out this SO article for a work around: HTML 5 Audio Looping

这篇关于是否有可能创建具有多个曲目同时播放JavaScript的音频播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆