Commit Graph

95 Commits

Author SHA1 Message Date
DIYgod 4d1cdb3341
better workflow 2018-01-12 11:53:25 +08:00
Michael 81002c0bf9 Removed check for hidden list, allows add music animation 2017-12-20 22:14:16 -05:00
Michael e3ce22bf7d Rounded up list.style.height to 33px 2017-12-20 08:03:01 -05:00
Michael 9d772ef052 Add music fix 2017-12-19 21:29:00 -05:00
Michael 77cc9d9528 Small comment change 2017-12-18 01:33:41 -05:00
Michael 88aff9111b Fixed Indenting and added changes from @DIYgod 2017-12-18 01:20:29 -05:00
Michael 82ca11d126 New remove song function 2017-12-15 15:03:52 -05:00
Eric Robinson 1a4ea7a4ed Change variables to constants for invariant values
Use const instead of let to help signify that the initialized values are not expected to change. This commit resolves some review requests on APlayer PR #175.
2017-12-14 11:04:08 -05:00
Eric Robinson 8a1f19ec57 Duplicate pause event logic into the abort event
It appears that the "pause" event is never triggered if you call `audio.pause()` on a playing audio element and then immediately set `audio.src`. The "abort" event, however, _is_ called in this case.

Because the "pause" event isn't raised, the APlayer code that resets the pause button state doesn't trigger. This leaves the APlayer in a state where the pause button is still showing but the audio element _isn't_ actually playing. Because `APlayer.toggle()` (which is called by the Play/Pause button) does not check the state of the audio element, and instead checks the state of the UI, we end up in a situation where the pause button is visible but we're not playing. The call to Toggle, then, calls `APlayer.pause()` which checks to see if it's already paused or not. Because the audio element is already paused, the call is ignored and the event never triggers (which would reset the button UI).

This [temporary] "fix" resolves the issue by intercepting the "abort" event that is triggered when the "pause" event is aborted. It then runs the same logic as the "pause" event, checking to see if the playback button is in a "paused" state and, if so, resetting it to a "play" button state.

_In theory_, the checks at the beginning of the `pauseHandler` arrow function should be enough to safeguard any other unrelated calls to "abort".
2017-12-12 16:38:41 -05:00
Eric Robinson e7168ec462 Actually set the music to the audio element
In the default state, each audio element should already have the music url set. However, if a user externally adjusts the music stored on the APlayer and attempts to switch to it, everything _but_ the audio would change. This allows users to modify the music set in the options manually.
2017-12-12 13:42:54 -05:00
Eric Robinson 17c80e4083 Do not autoplay in mobile in `setMusic`
This change appears to have been made to support playlist auto-advance in mobile. This was a workaround to handle the autoplay guard lower in the function which was removed in an earlier commit on this branch. The play call is now handled external to the `setMusic` call, which allows external logic to determine whether play should be called on mobile or not.
2017-12-12 13:40:39 -05:00
Eric Robinson fa66dd90f4 Ensure that automatic playlist advance works
When playlists advance, the music should continue to play. The recent change to stop `setMusic` from "autoplaying" in this case must now be handled directly by the caller. This is far more clear to read: "set next music and play it."
2017-12-12 13:37:31 -05:00
Eric Robinson bd4426ff2b Remove redundant check
The constructor ensures that autoplay is false for mobile devices at this point.
2017-12-12 13:11:12 -05:00
Eric Robinson c0e868484a Move the autoplay check into the constructor
The `autoplay` option only makes sense in the constructor. After that, callers of `setMusic` should determine whether or not to begin playback based on their own state.
2017-12-12 13:09:35 -05:00
Eric Robinson db6e0f8b84 Verify actual state rather than flag
No need to track against a separate (and possibly out-of-sync) flag when it is just as easy to check the actual state of the loaded music.
2017-12-12 12:35:26 -05:00
Eric Robinson 00bec0c66e Remove unnecessary branches in code
Modulo operators are perfect for this type of logic.
2017-12-12 11:55:39 -05:00
Michael 77d00898be Fixes no author showing bug 2017-11-23 16:55:42 -05:00
gkiwi 00aac89320 Merge branch 'master' of github.com:bugkiwi/APlayer 2017-11-14 19:07:21 +08:00
gkiwi 1fd103c326 修复aplayer-list listmaxheight判断 语法错误问题
Change-Id: I90d1fab602500bcffdac82cb3b19a9b37e636de8
2017-11-14 19:02:17 +08:00
DIYgod f6fdb2a49d
Merge pull request #162 from kn007/patch-1
fix pic 重复打印,拉伸输出
2017-11-01 21:35:59 -05:00
Karl Chen 665b0e7342
Update APlayer.scss 2017-10-31 23:00:16 +08:00
Karl Chen ceb2bc5feb
Update APlayer.js 2017-10-31 12:10:36 +08:00
DIYgod dedcfbf1ac
switch to next song in mobile, close #138 2017-06-08 00:16:56 +08:00
Tommy Nguyen 9a99a327e3 Wrap getSVG calls in template literal syntax 2017-03-31 11:56:06 -04:00
DIYgod cbc0f99eee new api: destroy, addMusic 2017-03-26 23:31:22 +08:00
DIYgod d381582fe4
prevent buttons from submitting forms 2017-02-09 11:22:58 +08:00
DIYgod 53096c4e0b
unify `ap.play()` with `ap.audio.play()`, close #98 2016-12-22 00:14:12 +08:00
DIYgod c4c3ead825
fix NaN before canplay, close #94 2016-12-21 18:48:02 +08:00
DIYgod a0467709eb
Fix lrc background, close #100 2016-12-01 09:56:20 +08:00
DIYgod 3877378602
fix switching music bug, close #83 #85 2016-10-26 21:17:31 +08:00
DIYgod 0b0be17c70
bind play() pause() function to play pause event 2016-10-24 10:37:36 +08:00
DIYgod 96190c0ebf
better single icon 2016-10-18 18:31:58 +08:00
DIYgod e78ac91628
fix CSS confliction in button 2016-10-17 10:20:24 +08:00
DIYgod 9030303ad1
update devDependencies 2016-10-17 10:00:10 +08:00
DIYgod 097fd27caa
update console version 2016-10-14 10:36:02 +08:00
DIYgod 5ce630df04
Optimize sorting algorithm for random mode, fix: #77 2016-10-14 10:26:50 +08:00
DIYgod c1c83d3c96
optimize the style of aplayer with lrc 2016-10-11 11:24:03 +08:00
DIYgod 89992c84c9
fix aplayer-bar width 2016-10-11 10:02:15 +08:00
Argenis Villasmil 02058ad17f display hh:mm:ss format when audio is over an hour long 2016-10-10 21:01:30 -04:00
DIYgod d7365d9546
Make music title and lrc selectable; click list to play next song in mobile: close #69 2016-09-30 11:13:35 +08:00
DIYgod 1386beaa27
Fix UMD bug 2016-09-26 01:50:13 +08:00
DIYgod 62d146a9dc
Scrollbar style, close #72 2016-09-20 12:12:21 +08:00
DIYgod fa0017c55d
random mode: from first music; play list: click to jump 2016-09-19 11:38:24 +08:00
DIYgod 9459d76b4b
New option: mode, listmaxhight 2016-09-19 10:34:12 +08:00
DIYgod f7e91c04d3
fix bug in `showlrc: 2` 2016-09-09 01:46:23 +08:00
DIYgod 4621a74691
fix getting lrc repeatedly 2016-08-28 00:20:50 +08:00
DIYgod f91eba1aba
New showlrc type: 3, get lrc from lrc file or API 2016-08-28 00:12:38 +08:00
DIYgod 210a9bbec0
Add console; Remove init function; Simplify this space; Update dev dependencies 2016-08-27 18:17:49 +08:00
DIYgod a1948749cd
build with webpack 2016-07-11 21:13:39 +08:00
DIYgod d2b673db39
fix long list title display error 2016-07-11 11:22:15 +08:00