•   over 1 year ago

How to test the livestreaming with spark AR studio

I noticed Spark AR has a live streaming module Is there a way to simulate or test live reactions and comments without having to go live on facebook?


  • Manager   •   over 1 year ago

    Hey Harry,

    Good question. I found this page: https://developers.facebook.com/docs/ar-studio/docs/testing-debugging/ which might help you, but I'm also reaching out to the Spark team for more info.


  •   •   over 1 year ago

    HI Harry,

    As far as I know, the best way to simulate a stream of comments from the live stream is to do it locally. You can alternate between importing the actual module (in production) and using your local mock class (during development) I've prepared a script to show you what I mean. This will have a fake stream of comments popping up every 1.5s when you test locally. Before publishing though, you should comment out the mock class, and uncomment the line where you import the module.


    // Production code -- uncomment this before publishing effect:
    // ---------------
    // const LiveStreaming = require('LiveStreaming');

    // Development code -- comment this out before publishing the effect:
    // ----------------
    var LiveStreaming = {};
    LiveStreaming.comments = {};
    LiveStreaming.comments.stream = {
    subscribe : function(delegate) {
    const Time = require('Time');
    const timeInMilliseconds = 1500;
    const mockNewCommentFromLive = () => {delegate('New comment from Live Stream');}
    Time.setInterval(mockNewCommentFromLive, timeInMilliseconds);

    // From this point on, the code should be the same for either prod or dev:
    const Diagnostics = require('Diagnostics');

    LiveStreaming.comments.stream.subscribe(function(comment) {
    Diagnostics.log(comment); // Do whatever you want with live comments from here.


Comments are closed.