FAQ
Lo,

Working on an application right now that allows a users to share audio
clips and listen to them together using HTML audio objects.

Here's a snippet of code to show what's up:

     audioRef.on('value', function (childSnapshot) {
       if (audio) audio.pause();
      var stream = "http://my-audio-server.com/audio/" + childSnapshot.val()"
       audio = new Audio(stream);
       audio.play();
     });

Super happy this works, but the problem is that both the audio stream as
well as Firebase load data into each of the clients at different
rates/times, so the audio files are always a few seconds off between
devices. How can I best mitigate this?

At the very least, I imagine I could wait for all the audio objects to be
loaded across devices before changing audioRef.
Would https://github.com/firebase/firebase-queue be what you guys recommend
to make this happen?

But the more difficult issue comes with having all devices start the audio
stream at an identical moment... is there any way for audioRef.on "value"
to fire at the same time across all devices?

Gratzi,
Jordan


--
You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
To post to this group, send email to firebase-angular@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/ee69f87d-4bfd-4f00-bb85-101094b8ce2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jacob Wenger at Jun 5, 2015 at 4:26 am
    Hey Jordan,

    Sounds like an interesting project. And an interesting problem! I don't
    think Firebase Queue fits your use case, but you should be able to
    coordinate timing across a bunch of different clients by using server time
    offset functionality. Check out our docs on "Handling Latency,"
    <https://www.firebase.com/docs/web/guide/offline-capabilities.html>
    specifically
    the part about clock skew. Since each client can get their time offset from
    our servers, you can store a start time in your Firebase database and each
    client can start it at exactly that time. That way, everyone should be in
    sync!

    Hope that helps,
    Jacob
    On Mon, Jun 1, 2015 at 11:04 PM, Jordan Rein wrote:

    Lo,

    Working on an application right now that allows a users to share audio
    clips and listen to them together using HTML audio objects.

    Here's a snippet of code to show what's up:

    audioRef.on('value', function (childSnapshot) {
    if (audio) audio.pause();
    var stream = "http://my-audio-server.com/audio/" +
    childSnapshot.val()"
    audio = new Audio(stream);
    audio.play();
    });

    Super happy this works, but the problem is that both the audio stream as
    well as Firebase load data into each of the clients at different
    rates/times, so the audio files are always a few seconds off between
    devices. How can I best mitigate this?

    At the very least, I imagine I could wait for all the audio objects to be
    loaded across devices before changing audioRef. Would
    https://github.com/firebase/firebase-queue be what you guys recommend to
    make this happen?

    But the more difficult issue comes with having all devices start the audio
    stream at an identical moment... is there any way for audioRef.on "value"
    to fire at the same time across all devices?

    Gratzi,
    Jordan


    --
    You received this message because you are subscribed to the Google Groups
    "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/ee69f87d-4bfd-4f00-bb85-101094b8ce2c%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/ee69f87d-4bfd-4f00-bb85-101094b8ce2c%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/CAGcMwsC6yfP%3DGr7gN6NS0tzRB93-jwUYXUyAU74sM001XOxamA%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Jordan Rein at Jun 6, 2015 at 3:06 am
    Thanks Jacob, that'll work perfectly for my use case!
    On Thu, Jun 4, 2015 at 9:25 PM, Jacob Wenger wrote:

    Hey Jordan,

    Sounds like an interesting project. And an interesting problem! I don't
    think Firebase Queue fits your use case, but you should be able to
    coordinate timing across a bunch of different clients by using server time
    offset functionality. Check out our docs on "Handling Latency,"
    <https://www.firebase.com/docs/web/guide/offline-capabilities.html> specifically
    the part about clock skew. Since each client can get their time offset from
    our servers, you can store a start time in your Firebase database and each
    client can start it at exactly that time. That way, everyone should be in
    sync!

    Hope that helps,
    Jacob
    On Mon, Jun 1, 2015 at 11:04 PM, Jordan Rein wrote:

    Lo,

    Working on an application right now that allows a users to share audio
    clips and listen to them together using HTML audio objects.

    Here's a snippet of code to show what's up:

    audioRef.on('value', function (childSnapshot) {
    if (audio) audio.pause();
    var stream = "http://my-audio-server.com/audio/" +
    childSnapshot.val()"
    audio = new Audio(stream);
    audio.play();
    });

    Super happy this works, but the problem is that both the audio stream as
    well as Firebase load data into each of the clients at different
    rates/times, so the audio files are always a few seconds off between
    devices. How can I best mitigate this?

    At the very least, I imagine I could wait for all the audio objects to be
    loaded across devices before changing audioRef. Would
    https://github.com/firebase/firebase-queue be what you guys recommend to
    make this happen?

    But the more difficult issue comes with having all devices start the
    audio stream at an identical moment... is there any way for audioRef.on
    "value" to fire at the same time across all devices?

    Gratzi,
    Jordan


    --
    You received this message because you are subscribed to the Google Groups
    "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/ee69f87d-4bfd-4f00-bb85-101094b8ce2c%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/ee69f87d-4bfd-4f00-bb85-101094b8ce2c%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/firebase-angular/hWXQToLgmXM/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/CAGcMwsC6yfP%3DGr7gN6NS0tzRB93-jwUYXUyAU74sM001XOxamA%40mail.gmail.com
    <https://groups.google.com/d/msgid/firebase-angular/CAGcMwsC6yfP%3DGr7gN6NS0tzRB93-jwUYXUyAU74sM001XOxamA%40mail.gmail.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/CAC_pQYE7fca9jKCv-4fvPa8ZrS5ppzRBKEa4N-92TRKVegpnJQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedJun 2, '15 at 6:04a
activeJun 6, '15 at 3:06a
posts3
users2

2 users in discussion

Jordan Rein: 2 posts Jacob Wenger: 1 post

People

Translate

site design / logo © 2021 Grokbase