Skip to main content
January 28, 2011
Question

How to change the video publish mode seaminglessly?

  • January 28, 2011
  • 1 reply
  • 561 views

That is , I don't need to terminate the current publishing video then republish again.

I just want to change the publish mode,maybe from live to recorded mode.

How to do this ?

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    January 28, 2011

    Are you looking from publisher context or playback context?

    If its publisher context, i would recommend you to just do live publish and then start & stop recording whenever you want using server-side code. Say you start the publish and start recording on the server & now when you want to make it live again - just stop the recording. But actually "live" feed is all the time available when you are recording too - it all depends on client how it is subscribing in "live" or "record" mode.

    Now if its playback context - you can start playing recorded file and when playback stops, you can switch to live playback.

    January 28, 2011

    I'm  looking from publisher context.

    "when you want to make it live again - just stop the recording. "

    That's the part I don't know how to do...

    Participating Frequently
    January 29, 2011

    See below code (its not best but would explain something t you atleast:-

    main.asc

    application.onPublish  = function(cobj,sobj){

      application.pubClient = cobj;

      application.pubStream = sobj;

    }

    application.pubClient.startRecord = function(){

         application.pubStream.record();

    }

    application.pubClient.stopRecord = function(){

         application.pubStream.record(false);

    }

    I have not tried the code personally - but i think it should work - can you try it out and let me know.

    In above code, say if publisher publishes stream by name "mystream" , whenever he calls startRecord - it would be available as live as well as recorded mode and once he calls stop record it would be available only in live mode.