Skip to content

Adds sample code for starting a 2nd presentation. #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,32 @@ <h3>
document.appendChild(spanElt);
};
&lt;/script&gt;
</pre>
</section>
<section>
<h3>
Creating a second presentation from the same controlling page
</h3>
<pre class="example">
&lt;!-- controller.html --&gt;
&lt;!-- The same controlling page can create and manage multiple presentations,
by calling start() multiple times. --&gt;
&lt;button id="secondPresentBtn" style="display: none;"&gt;Present Again&lt;/button&gt;
&lt;script&gt;
var secondPresentBtn = document.getElementById("secondPresentBtn");
var secondPresUrl = "https://example.com/second-presentation.html";
var secondRequest = new PresentationRequest(secondPresUrl);
// For simplicity, the logic to handle screen availability for secondRequest
// and update the status of secondPresentBtn is omitted.
secondPresentBtn.onclick = function () {
// Start new presentation, likely on a different screen than the original
// request.
secondRequest.start().then(setSecondConnection);
};
function setSecondConnection(newConnection) {
// Logic to handle messages to/from second-presentation.html.
};
&lt;/script&gt;
</pre>
</section>
</section>
Expand Down