forked from rauversion/rauversion-phx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proxy controller, audio player tweaks
- Loading branch information
Showing
10 changed files
with
167 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule Rauversion.Services.PeaksGenerator do | ||
def run(file) do | ||
{output, _status} = | ||
System.cmd(audiowaveform_path(), [ | ||
"-i", | ||
file, | ||
"--pixels-per-second", | ||
"100", | ||
"--output-format", | ||
"json", | ||
"-" | ||
]) | ||
|
||
IO.inspect(output) | ||
|
||
frames = Jason.decode!(output)["data"] | ||
|
||
# audiowaveform -i ~/Desktop/patio/STE-098.mp3 | ||
|
||
# audiowaveform -i /root/audio.mp3 --pixels-per-second 100 --output-format json - | ||
end | ||
|
||
def audiowaveform_path() do | ||
"audiowaveform" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,34 +8,79 @@ | |
<%= live_title_tag assigns[:page_title] || "Rauversion", suffix: " · Phoenix Framework" %> | ||
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")}/> | ||
<script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://unpkg.com/@cassette/player/dist/css/cassette-player.css"> | ||
<!-- dependencies --> | ||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/prop-types.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/ResizeObserver.js"></script> | ||
|
||
<!-- other @cassette packages which are dependencies --> | ||
<script src="https://unpkg.com/@cassette/[email protected]/dist/es5/cassette-core.js"></script> | ||
<script src="https://unpkg.com/@cassette/[email protected]/dist/es5/cassette-components.js"></script> | ||
|
||
<!-- @cassette/player's javascript --> | ||
<script src="https://unpkg.com/@cassette/[email protected]/dist/es5/cassette-player.js"></script> | ||
|
||
</head> | ||
<body> | ||
|
||
<%= render "_user_menu.html", assigns %> | ||
|
||
<p class="notice"></p> | ||
<p class="alert"></p> | ||
<%= @inner_content %> | ||
|
||
|
||
<%= if System.get_env("CHASKIQ_APP_ID") do %> | ||
<script> | ||
(function(d,t) { | ||
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; | ||
g.src="https://app.chaskiq.io/embed.js" | ||
s.parentNode.insertBefore(g,s); | ||
g.onload=function(){ | ||
new window.ChaskiqMessengerEncrypted({ | ||
domain: 'https://app.chaskiq.io', | ||
ws: 'wss://app.chaskiq.io/cable', | ||
app_id: "<%= System.get_env("CHASKIQ_APP_ID") %>", | ||
//data: "YOUR_ENCRYPTED_JWE_DATA", | ||
//lang: "USER_LANG_OR_DEFAULTS_TO_BROWSER_LANG" | ||
}) | ||
} | ||
})(document,"script"); | ||
</script> | ||
<% end %> | ||
<p class="notice"></p> | ||
<p class="alert"></p> | ||
<%= @inner_content %> | ||
|
||
<div id="app">app</div> | ||
|
||
<%= if System.get_env("CHASKIQ_APP_ID") do %> | ||
<script> | ||
(function(d,t) { | ||
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; | ||
g.src="https://app.chaskiq.io/embed.js" | ||
s.parentNode.insertBefore(g,s); | ||
g.onload=function(){ | ||
new window.ChaskiqMessengerEncrypted({ | ||
domain: 'https://app.chaskiq.io', | ||
ws: 'wss://app.chaskiq.io/cable', | ||
app_id: "<%= System.get_env("CHASKIQ_APP_ID") %>", | ||
//data: "YOUR_ENCRYPTED_JWE_DATA", | ||
//lang: "USER_LANG_OR_DEFAULTS_TO_BROWSER_LANG" | ||
}) | ||
} | ||
})(document,"script"); | ||
</script> | ||
<% end %> | ||
|
||
<script> | ||
// your code! | ||
|
||
|
||
var MediaPlayer = cassettePlayer.MediaPlayer; | ||
|
||
var playlist = [ | ||
{ | ||
url: | ||
'http://localhost:4000/active_storage/blobs/proxy/SFMyNTY.eyJleHBpcmVzX2luIjpudWxsLCJtZXNzYWdlIjoiNDciLCJwdXJwb3NlIjpudWxsfQ.AO68siAf82PqS4YOCET8OZlUB3MoMCKPcOjnJv-4yYs/STE-064.mp3', | ||
title: 'Big Buck Bunny' | ||
} | ||
]; | ||
|
||
ReactDOM.render( | ||
React.createElement( | ||
MediaPlayer, | ||
{ | ||
playlist: playlist, | ||
showVideo: false | ||
} | ||
), | ||
document.getElementById('app') | ||
); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Rauversion.PeaksGeneratorTest do | ||
use Rauversion.DataCase | ||
|
||
alias Rauversion.Playlists | ||
|
||
describe "peaks generator" do | ||
test "peaks gen" do | ||
Rauversion.Services.PeaksGenerator.run("/Users/michelson/Desktop/patio/STE-098.mp3") | ||
end | ||
end | ||
end |