There is no such thing like track.close(). Track is only stopped and that is it, it is released from the device. I guess by refreshing you mean that the stream is recaptured from the device and is produced again automatically. If that is right then you will have to do this like this there is no automatic way:
1- When user will click publish then you will get stream from camera/microphone and then you will produce the tracks.
2- When user will click finish then you will stop all the tracks and then close the producer and transport as well.
3- When user click publish again then do step 1). And that continues.
THX!!! really glad to find what’s the problem is,
but the readyState is not update properly… is this the problem of producer & producerTransport is not finish??