Skip to content

Commit

Permalink
Attempt bugfix for IOS devices.
Browse files Browse the repository at this point in the history
Reportedly,
on iOS devices, regardless of browser, the html5 audio player would
reach a hung state when the play button would be clicked.
This was flaky.

Empirically, it was observed that on instances when the hung state
happens, the formatDisplayTime() fn errored out. This was likely due to
the face that the Date::toISOString() was receiving Infinity as an
argument and hence was erroring out.

This fix should account for that case, and hopefully fix the general
hung state issue on IOS.
  • Loading branch information
rtshkmr committed Mar 10, 2024
1 parent b1f5e30 commit 89d1915
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion assets/js/utils/time_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
* hh:mm:ss e.g. 00:12:05
* */
export const formatDisplayTime = (seconds) => {
return new Date(1000 * seconds).toISOString().substring(11, 19)
let formatted = null
try {
formatted = new Date(1000 * seconds).toISOString().substring(11, 19)
} catch (e) {
console.warn("Errored out when doing time conversions.", e)
} finally {
return formatted
}
}

export const nowSeconds = () => Math.round(Date.now() / 1000)
3 changes: 2 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ config :ex_aws, :retries,
config :vyasa, VyasaWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: System.get_env("PORT") || 4000],
# http: [ip: {127, 0, 0, 1}, port: System.get_env("PORT") || 4000],
http: [ip: {0, 0, 0, 0}, port: System.get_env("PORT") || 4000],
check_origin: false,
code_reloader: true,
debug_errors: true,
Expand Down

0 comments on commit 89d1915

Please sign in to comment.