Flashphoner.releaseLocalMedia(document.getElementById("display"), "WebRTC");
Hello
Code:Flashphoner.releaseLocalMedia(document.getElementById("display"), "WebRTC");
releaseLocalMedia function does not work for mock video element because it is used only for passing source video to custom element and is destroed onFlashphoner.releaseLocalMedia(mockLocalDisplay.get(0), "WebRTC");
STREAM_STATUS.PUBLISHING
event.localVideo
div. You should set custom video element id with suffix --LOCAL_CACHED_VIDEO
, for example (based on TwoWayStreaming code)...
<div class="col-sm-6">
<div class="text-center text-muted">Local</div>
<div class="fp-Video">
<div id="localVideo" class="display"><video id="customVideo-LOCAL_CACHED_VIDEO" controls="controls" style="background-color: lightgrey;"></div>
</div>
...
localVideo
element in display
option while creating a stream to publish as done in all examples: session.createStream({
name: streamName,
display: localVideo
...
}).on(STREAM_STATUS.PUBLISHING, function (stream) {
...
}).publish();
Flashphoner.releaseLocalMedia
function onPublishing(stream) {
$("#publishBtn").text("Stop").off('click').click(function () {
$(this).prop('disabled', true);
stream.stop();
Flashphoner.releaseLocalMedia(localVideo, "WebRTC");
}).prop('disabled', false);
$("#publishInfo").text("");
}
releaseLocalMedia function does not work for mock video element because it is used only for passing source video to custom element and is destroed onSTREAM_STATUS.PUBLISHING
event.
If you wish to customize local video element (define controls and style), you can use the following trick:
1. In HTML page code, add custom video element tolocalVideo
div. You should set custom video element id with suffix--LOCAL_CACHED_VIDEO
, for example (based on TwoWayStreaming code)
2. UseHTML:... <div class="col-sm-6"> <div class="text-center text-muted">Local</div> <div class="fp-Video"> <div id="localVideo" class="display"><video id="customVideo-LOCAL_CACHED_VIDEO" controls="controls" style="background-color: lightgrey;"></div> </div> ...
localVideo
element indisplay
option while creating a stream to publish as done in all examples:
3. After stopping a stream, callJavaScript:session.createStream({ name: streamName, display: localVideo ... }).on(STREAM_STATUS.PUBLISHING, function (stream) { ... }).publish();
Flashphoner.releaseLocalMedia
In this case custom video element id will be changed, but style and contols will remain.Code:function onPublishing(stream) { $("#publishBtn").text("Stop").off('click').click(function () { $(this).prop('disabled', true); stream.stop(); Flashphoner.releaseLocalMedia(localVideo, "WebRTC"); }).prop('disabled', false); $("#publishInfo").text(""); }
You cannot applyI'm having an issue with releaseLocalMedia, if any of you could help. I'm have a div, id="local-display", which has a video element in it. When I try and release it, I always receive a return of false. I have attached a screenshot of my in browser console, and the element tree.
Flashphoner.releaseLocalMedia
to custom video element, it should be created automatically by WebSDK in div.Sorry for being unclear, as I was showing the end result and not the code that generates it. The WebSDK does generate my video element, it is not hardcoded by myself.You cannot applyFlashphoner.releaseLocalMedia
to custom video element, it should be created automatically by WebSDK in div.
You can use workaround recommended in the post above.
Flashphoner.releaseLocalMedia
works in Media Devices example (press "Test" button, then press "Release").