Results 1 to 4 of 4

Thread: After browser refresh stream not unpublished

  1. #1
    Join Date
    Sep 2012
    Posts
    21

    Default After browser refresh stream not unpublished

    I publish a simple cam stream in the browser and I also watch it. When I enter the page it works good, but after a refresh it says that the stream is duplicate. This is my wowza output:

    INFO session connect-pending *.*.*.* -
    INFO session connect *.*.*.*-
    INFO stream create - -
    INFO stream publish ruben -
    -------------------------- refresh
    INFO session connect-pending *.*.*.*-
    INFO session connect *.*.*.*-
    INFO stream create - -
    INFO server comment - ModuleBlockDuplicateStreamNames.publish[cam/_definst_]: Stream name is already in use: ruben
    INFO stream destroy - -
    -------------------------------- another refresh
    INFO stream unpublish ruben -
    INFO stream destroy ruben -
    INFO session disconnect 184595543 -
    INFO session connect-pending *.*.*.*-
    INFO session connect *.*.*.*-
    INFO stream create - -
    INFO stream publish ruben -


    I have the module ModuleBlockDuplicateStreamNames installed, beacuse no duplicate streams should be allowed. Can anybody explain this strange behavior. It behaves different after a refresh in the browser.

  2. #2
    Join Date
    Sep 2012
    Posts
    21

    Default

    If I add a sleep of 5 seconds with javascript before the flash object is loaded in the webpage it tells me that after a refresh nothing happens in output of wowza. If I however refresh the browser again within the 5 seconds the wowza output says that I am disconnected. I use IE9 as a browser. This happens:

    - I open the browser
    - wait 5 seconds before the flash object is loaded
    - the flash object is loaded and connects tot wowza
    - I refresh the browser
    - wait 5 seconds (during the wait, nothing happens in wowza output, if I refresh again within the 5 seconds it disconnects immediately)

  3. #3
    Join Date
    Sep 2012
    Posts
    21

    Default

    I have similar behavior without the ModuleBlockDuplicateStreamNames. In Chrome it works ok, but in IE9 a disconnect isn't triggered. Can someone please help me. Looking for a solution for a long time now.

    I tried to solve it clientside, but I can't unpublish a stream with the same name on clientside. Something like:

    If streamname already exit, close it and start a new stream with the same name. My client side code is like:

    stop();
    stage.align = "TL";
    stage.scaleMode = "noScale";

    var nc:NetConnection = null;
    var camera:Camera;
    var microphone:Microphone;
    var nsPublish:NetStream = null;
    var connectStr:String;
    var publishName:String;

    connectStr = "rtmp://*.*.*.*/cam";
    publishName = "ruben";

    function showMessage(msgtxt:String):void {
    msg.txt.text = msgtxt;
    msg.visible = true;

    debugMessage("showMessage: " + msgtxt);
    }

    function debugMessage(msg:String):void {
    trace(msg);
    ExternalInterface.call("debugMessage",msg);

    }

    function hideMessage():void {
    msg.visible = false;
    msg.txt.text = '';
    }

    function doCamera():void {
    msg.visible = false;
    if (Camera.names.length > 0) {

    var cameraIdx:int = -1;
    for (var idx = 0,len = Camera.names.length; idx < len; idx++) {
    if (Camera.names[idx] == "USB Video Class Video") {
    cameraIdx = idx;
    idx = len;
    }
    }
    if (cameraIdx > -1) {
    camera = Camera.getCamera(String(cameraIdx));
    } else {
    camera = Camera.getCamera();
    }

    microphone = Microphone.getMicrophone();
    if (camera == null) {
    showMessage("De camera is in gebruik!");
    } else {
    camera.setMode(320,240,15,true);
    camera.setQuality(0,90);
    camera.setLoopback(true);
    camera.setKeyFrameInterval(30);
    camera.addEventListener(StatusEvent.STATUS,cameraOnStatus);
    microphone.setSilenceLevel(0);
    microphone.rate = 11;
    videoCamera.clear();
    videoCamera.attachCamera(camera);

    doConnect();
    Security.showSettings(SecurityPanel.PRIVACY);

    }
    } else {
    showMessage("Er is geen camera aanwezig!");
    }
    }

    function undoCamera():void {
    videoCamera.attachCamera(null);
    videoCamera.clear();
    }


    function cameraOnStatus(infoObject:StatusEvent):void {
    trace("camera: " + infoObject.code);
    if (infoObject.code == "Camera.Muted") {
    debugMessage("cameraOnStatus (muted): " + camera.muted);
    //showMessage("Klik op \"Toestaan\" of \"Allow\" voor toegang!...");
    } else if (infoObject.code == "Camera.Unmuted") {
    debugMessage("cameraOnStatus (muted): " + camera.muted);
    //hideMessage();
    }
    }


    function doConnect():void {
    if (nc == null) {
    nc = new NetConnection();
    nc.addEventListener(NetStatusEvent.NET_STATUS,ncOnStatus);
    nc.connect(connectStr);
    } else {
    undoConnect();
    doConnect();
    }
    }

    function undoConnect():void {
    if (nc == null) {

    } else {
    undoPublish();
    nc.close();
    nc = null;
    }
    }

    function ncOnStatus(infoObject:NetStatusEvent):void {
    debugMessage("nc: " + infoObject.info.code + " (" + infoObject.info.description + ")");

    if (infoObject.info.code == "NetConnection.Connect.Success") {
    doPublish();
    } else if (infoObject.info.code == "NetStream.Publish.Denied") {
    showMessage("Stream is al in gebruik!");
    }
    }

    function nsPublishOnStatus(infoObject:NetStatusEvent):void {
    debugMessage("nsPublish: " + infoObject.info.code + " (" + infoObject.info.description + ")");
    if (infoObject.info.code == "NetStream.Play.StreamNotFound" || infoObject.info.code == "NetStream.Play.Failed") {
    // undoPublish();
    }
    }

    function doPublish():void {
    if (nsPublish == null) {
    nsPublish = new NetStream(nc);
    nsPublish.addEventListener(NetStatusEvent.NET_STATUS,nsPublishOnStatus);
    nsPublish.bufferTime = 0;
    nsPublish.publish(publishName);
    nsPublish.attachCamera(camera);
    nsPublish.attachAudio(microphone);
    } else {
    undoPublish();
    doPublish();
    }
    }

    function undoPublish():void {
    if (nsPublish == null) {

    } else {
    nsPublish.attachCamera(null);
    nsPublish.attachAudio(null);
    nsPublish.publish("null");
    nsPublish.close();
    nsPublish = null;
    }
    }

    doCamera();

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    If streamname already exit, close it and start a new stream with the same name.
    If the above is your requirement, then disable the ModuleBlockDuplicateStreamNames, because that is the default server-side behavior without that module in place.

    To make sure every client is sending a unique stream name, you might do something like append a random number of hash to the stream name, then clip that part out where it is shown to users.

    Richard

Similar Threads

  1. MediaCaster refresh
    By emaama1 in forum Live Streaming and Encoder Discussion
    Replies: 1
    Last Post: 10-07-2013, 08:45 AM
  2. rtsp stream unpublished
    By coolcloud in forum General Forum
    Replies: 2
    Last Post: 11-09-2012, 11:07 PM
  3. LiveStreamRecorder stream unpublished issues
    By josnidhin in forum Server-side Modules and Code Samples Discussion
    Replies: 7
    Last Post: 02-23-2012, 07:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •