Giter Club home page Giter Club logo

muplayer's Issues

部分移动浏览器不能自动播放时会导致选链失败

因为这些浏览器要求audio的播放必须是用户的主动交互操作(如点击滑动等),而如果只是在代码中调用play方法,会让player卡在buffering状态,导致即便主动交互时选链逻辑依然失效。应该修复这个问题。

列表播放的顺序有误

在mode为list时,即列表播放时,应该在播完最后一首歌后停止播放,并将列表重置回第一首。在播放第一首时,如果点击“上一首”,则停止播放。具体播放顺序逻辑应与iTurns一致。
现在的列表播放和循环播放没有区别,应该立即修复。

内核的自动切换机制

现在只在第一次使用时有对具体播放内核的判定,但之后的异常处理基本没有。今后应该有自动的异常处理和内核切换机制,比如如果AudioCore内核多次重试不成功就应该自动切换到FlashCore内核,并记录日志。FlashCore亦然。

支持zepto.js

现有的实现中依赖了一些jQuery方法(比如$.getScript, $.isNumberic),但这些方法不是zepto的默认接口,需要提供一个兼容性扩展,保证在使用zepto的WebApp中可以顺利调用播放内核。

服务器环境下测试出错

本地测试没有问题,在jekyll serve下测试时,firebug报错TypeError: _mu.Player is not a constructor,已在jquery之后引用<script src="../js/player.js"></script>

对应的as没有改变就不去重新编译

命令行下通过flex-sdk编译,即便源文件没有变更,编译后的swf二进制文件也会不同。猜测是在编译时打了时间戳。这样会造成git ci时提交无用代码。考虑:

  1. 查阅下文档,在编译时不打时间戳(但之前好像看过一些,这个没有提供API,需要在了解下)
  2. 根据as文件的md5值或git diff看文件是否改变,未改变就不去重新编译

重构并完善单元测试

之前写过简单的qunit测试以覆盖核心的播放暂停等功能。但好久没有维护,且无法再命令行下运行。
考虑迁移到Mocha,补充必要的测试用例

重复调用 play(pos) 无效

var player = new _mu.Player();

player.add('http://cdn.y.baidu.com/yinyueren/c6000a27abee2510722b4bb092c766a3.mp3');
player.play();
// 这时能正常从第10秒开始播放,此时 player._st 为 stop
player.play(10000);
// 之后调用 .play(pos) 无效,此时 player._st 为 play ,跳过了如下判断
// https://github.com/Baidu-Music-FE/muplayer/blob/master/src/js/player.coffee#L217
player.play(60000);

CSS以及JS引入还是有问题!

1.muplayer-master/doc/demo.html文件里直接写个“../src/doc/demo.html”怎么能打开?

2./muplayer-master/src/doc/demo.html 相同目录下就没有对应的css和js 文件,打开根本就没有样式,也播放不了!

非单实例用例下的支持

现在默认Player都是单实例。但页面中,可能有需要同时初始化多个内核的需求。这时要让播放、UI渲染及事件监听互不干扰。

建议使用 browserify 打包项目

比如使用 browserify 后可以直接使用 node 的 event 的库实现事件的部分而不需要考虑依赖问题。browserify 会自动把轻量的 event 实现插入到编译的代码中。很多其他 node 的库都可以直接使用。

Flash内核对playing播放状态的派发有误

@Javey 在使用中发现的问题。播放事件的派发应遵循应prebuffer -> buffering -> playing的顺序。现在MP3Core在是先派发playing,然后置于buffering状态不会再变会playing,这样在应用端无法准确判断内核是否是在播放。

IE8- 下跑不通

IE8- 都跑不通了.

通过断点看到报错:

function __flash__addCallback(instance, name) {
  instance[name] = function () { 
    return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
  }
}

对象不支持此属性或方法

Firefox 31的Audio内核调用play方法失效

排查了下,之前对AudioCore play方法的使用是依赖canplay事件,会先判断audio.readyState状态码,根据状态码监听canplay事件,直到audio派发了canplay事件才去调用audio.play。这样做是为了回避webkit内核的浏览器在audio未派发canplay事件时调用play,会导致报错的问题。

但是Firefox 31等浏览器对HTML 5规范的实现并不标准,即便readyState为0或1时,依然可能已经派发过canplay事件,导致内核对canplay事件的监听失效,无法播放。

音效均衡器插件

考虑利用Web Audio API实现一个插件形式的音效增强均衡器,大概如:http://labs.music.baidu.com/demo/audiolab/?p=1

源码中会包括:

  1. 对指定频段的音效调节
  2. 有限集的默认风格支持(流行、人声、金属、默认等)
  3. 基础的set, get方法
  4. 插件的接入形式

暂时不会包括:

  1. 对应的UI及交互(但应该会写一个示例,只是UI相关的不放到源码里)
  2. 不支持Web Audio API的降级实现(暂时报错即可,之后可能会支持Flash降级方案,但不在这个issue里完成)

如何只播放一次

非常棒的工具:smile:

使用过程中遇到点问题,比如只想在按钮点击后播放一次按钮声音该如何做。

目前的模式似乎都是循环的。

你那些bootstrap的库和jquery ui的都没有,我没法使用啊

demo源码看不到效果,但是还有页面乱码问题,另外在首页使用都没说要引入哪些js文件或css文件。还有那个签出源码依赖是linux上的shell脚本,lib/install.sh,那我在window上没有这一步,直接引用,没法实现,现在还是只能用jplayer了

Flash存在反射xss漏洞

通过构造参数的方式可以执行传入的代码,例如:
muplayer_mp4.swf?_instanceName=eval(%22if(!window.x)alert(x=7)%22)

cake build 编译失败

错误信息如下:

$ cake build
...
js/player.js


/home/xxxx/develop/github/muplayer/node_modules/q/q.js:126
                    throw e;
                          ^
Error: Error: ENOENT, no such file or directory '/home/xxxx/develop/github/muplayer/require_temp/js/plugin/audioNode.js'
In module tree:
    muplayer/plugin/equalizer

  at /home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:25976:19
  at /home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:3005:39
  at /home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:2945:25
  at Function.prim.nextTick (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:25806:9)
  at Object.p.errback (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:2944:26)
  at Object.p.callback (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:2930:23)
  at Object.p.promise.then (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:2984:23)
  at build (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:25933:12)
  at runBuild (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:27859:17)
  at Object.context.execCb (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:1898:33)
  at Object.Module.check (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:1114:51)
  at Object.Module.enable (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:1391:22)
  at Object.Module.init (/home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:1022:26)
  at /home/xxxx/develop/github/muplayer/node_modules/requirejs/bin/r.js:1664:36
  at process._tickCallback (node.js:415:13)

src/js/plugin/ 下的 audionode.coffee 重命名为 audioNode.coffee 可以修复该问题。
是我安装的 node 或 CoffeeScript 的版本不对吗?

$ node --version
v0.10.26
$ coffee --version
CoffeeScript version 1.8.0

播放Content-Type: application/octet-stream的mp3列表,在IE下只能正常播第一首

比如是这样的音乐列表:
[
'http://m5.file.xiami.com/416/39416/434742/1770138305_2174201_l.mp3?auth_key=7e90cfc4579dc81a09d3f3b1b24ab1ed-1404604800-0-null',
'http://m5.file.xiami.com/1/232/10232/319903/3610946_467149_l.mp3?auth_key=b5a478fdefbf83f82b73aed4ded8d1ba-1404604800-0-null',
'http://m5.file.xiami.com/247/13247/105251/1333257_1777128_l.mp3?auth_key=1019a18c54b0f656ded2a95458d75f37-1404604800-0-null',
'http://m5.file.xiami.com/801/110801/1881462144/1772240319_10912275_l.mp3?auth_key=7697d220d0e366195e13410798ed19cf-1404604800-0-null']

只能播放第一首,后面的都是onerror了,如果无法解码的话,那应该第一首也是播不了才对。

文档中的代码示例不依赖gist

现在的代码示例都是保存在gist中,这样有两个问题:

  1. gist国内访问很慢,导致文档站加载速度很慢
  2. 示例中的源码因为变更导致和gist中的不一致

考虑找一个代码格式化库,在文档站本地去做示例代码的渲染

建议解除对 jquery 的依赖

对jquery的依赖感觉太重了,如果网站没使用框架或使用别的基础框架就还需要额外引入jquery这样感觉不大好了

Flash MP3内核的重构

现在的这个是从项目中摘出来的之前同事写的,但是看了看,还是有很多地方可以精简优化的,可以考虑重构一下。

跟require.js一起使用的时候不对啊

define(['MuPlayer'], function(_mu) {
_mu // undefined..
});
确定MuPlayer已经加载了
发现_mu 是在全局对象上的一个空对象。。。
require.js 版本是 2.1.15

在未有任何交互前自动播放引起的Bug

由于内核给第一次touchstart事件绑定了播放空音频的处理方法,导致在自动播放后的任意一次点击交互,空音频都会覆盖掉当前正在播放的音频. 解决方法是给播放空音频操作加上前置判断,仅当audio的url为空时才执行

建议给object元素加上tabindex=-1

建议将object元素加上tabindex=-1属性。原因:
tab键切换到播放器控件后,在IE下,非常容易卡焦点,导致tab无法离开播放器。这对使用键盘操作为主的用户,比如盲人用户有很大的影响。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.