はじめに
ふと、選択したディレクトリ内のmp3ファイルを再生する音楽プレイヤーが欲しいなと思ったので作りました。
名前は、「兎亜」です。
ウィンドウサイズも小さくして、デスクトップでの作業の邪魔にならないようにしました。
![desktop.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2F9606ba0f-0fbb-6b21-5ee2-13b0dd0ba3bd.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=83e8c900d17946054a52d9ab139ddfa2)
内容
コンポーネントの部分は、Riot使ってます。
なんとなく使ってるので、使い方合ってるのかよくわかんないです。
曲の再生部分は、Web Audio APIを使わず、
let sample = new Audio()
sample.src = 'demo.mp3'
のような感じで普通のAudio使ってます。
動作
Twitterにデモ動画をツイートしているのでそちらを。
シンプルな音楽プレイヤーが欲しかったのでElectronで作りました。
— yuki540 (@eriri_jp) 2017年4月8日
選択したディレクトリのmp3ファイルを再生します。
名前は、「兎亜」です。
GitHub: https://t.co/v1yjAcp1uN
Download: https://t.co/J1s30RmECq pic.twitter.com/pTkr51xpSP
ダウンロード
「兎亜」を使いたい場合は、
https://github.com/yuki540net/toa/releases/tag/v0.0.1
で自身のOSにあったものをダウンロードしてください。
Mac/Windows/Linuxに対応しています。
使い方
まず、「兎亜」を起動してください。
![ready.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2F913bcdc3-45a4-89f0-e1d7-d3ee23108302.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=22c7cd0db9be42dd8bf9aa57477f3bc6)
ディレクトリを選択
検索のアイコンのボタンを押すと、
![open_1.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2Fb307bf58-fef3-6a4d-d860-fd3838d65f5f.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=7570163a26e191db657011dcee8e1bfd)
ディレクトリの選択画面が出るので、mp3ファイルの入ったディレクトリを選択してください。
![open_2.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2F36a47440-d116-0522-b34a-c930dc3d95ee.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=70d60e5c8f8ed1127af52dcba9b1bba4)
すると、ディレクトリの音楽が操作可能になります。
再生位置の移動
シークバーを移動させると、再生位置が調整できます。
![seek.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2F98f227c8-bbd4-f9c5-7827-f12e31b7b29e.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=aa4837887bd94d23af0431d8f4a918f6)
リピート
曲名の左のアイコンを押すと、全曲リピートと一曲リピートに切り替えられます。
![repeat.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2Fe723a317-9dda-27e2-73c9-f0c6cb46e6a0.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=a097311ea78bd41f0e8a25afb1fe1f16)
曲のスキップ
再生ボタンの左のアイコンを押すと、前の曲に戻ります。
![back.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2Fe115ea46-a9d8-22d5-21c0-686986bc5990.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=8f3a16089508a0429775a186799fa33f)
再生ボタンの右のアイコンを押すと、次の曲に進みます。
![forward.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2Ffb0496b3-09cf-848f-90c5-ed365ff8a1ad.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=8cd5814b986bf8c6e12e49c141d3c654)
曲の選択
リストのようなアイコンを押すと、
![playlist_1.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2Fd97ccda7-787c-54ca-329b-a760d3d7491c.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=c0dc3262fdf38d597e68716886dca18e)
曲の一覧に移動します。
変更したい曲のチェックボックスを押すと、曲を変更することができます。
![playlist_2.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F77608%2Fe95596c0-be93-9ffa-abbf-17e56e87f7a8.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=47cdd5f2d87420f6570a7a3aff0f242c)
さいごに
ちょこちょこバグりそうなので、空いた時間に修正していきます。
よければ、GitHubのStarください。
GitHub: https://github.com/yuki540net/toa
Twitter: https://twitter.com/eriri_jp