-
Couldn't load subscription status.
- Fork 49
fix: nicer messaging on mobile for screenshare. Fixes RED5DEV-1796. #656
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT | |||||||||||||||||
| WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||||||||||||||
| */ | ||||||||||||||||||
| // Chrome & Firefox | ||||||||||||||||||
| ;(function (window, document, red5prosdk) { | ||||||||||||||||||
| ;(function (window, document, red5prosdk, showModal) { | ||||||||||||||||||
| 'use strict' | ||||||||||||||||||
|
|
||||||||||||||||||
| var configuration = (function () { | ||||||||||||||||||
|
|
@@ -75,6 +75,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||||||||||||
|
|
||||||||||||||||||
| captureButton.addEventListener('click', async () => { | ||||||||||||||||||
| const stream = await capture() | ||||||||||||||||||
| if (!stream) { | ||||||||||||||||||
| var content = document.createElement('div') | ||||||||||||||||||
| content.style = 'text-align: center;' | ||||||||||||||||||
| content.innerHTML = ` | ||||||||||||||||||
| <p>Failed to capture screen share.</p> | ||||||||||||||||||
| <br/> | ||||||||||||||||||
| <p>If on a Mobile browser, this capability is not available.</p> | ||||||||||||||||||
| ` | ||||||||||||||||||
| showModal(content) | ||||||||||||||||||
| return | ||||||||||||||||||
| } | ||||||||||||||||||
| setupPublisher(stream) | ||||||||||||||||||
| }) | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -201,6 +212,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||||||||||||
| data: error.message, | ||||||||||||||||||
| }) | ||||||||||||||||||
| } | ||||||||||||||||||
| return null | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| function unpublish(publisher) { | ||||||||||||||||||
|
|
@@ -253,6 +265,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||||||||||||
| return targetPublisher.publish() | ||||||||||||||||||
| }) | ||||||||||||||||||
| .then(function () { | ||||||||||||||||||
| const [videoTrack] = mediaStream.getVideoTracks() | ||||||||||||||||||
| videoTrack.onended = async () => { | ||||||||||||||||||
| if (targetPublisher) { | ||||||||||||||||||
| unpublish(targetPublisher) | ||||||||||||||||||
|
Comment on lines
+269
to
+271
|
||||||||||||||||||
| videoTrack.onended = async () => { | |
| if (targetPublisher) { | |
| unpublish(targetPublisher) | |
| if (videoTrack) { | |
| videoTrack.onended = async () => { | |
| if (targetPublisher) { | |
| unpublish(targetPublisher) | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -705,4 +705,24 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||||||
| window.exposeSubscriberGlobally = function (subscriber) { | ||||||||
| window.r5pro_subscriber = subscriber | ||||||||
| } | ||||||||
|
|
||||||||
| window.showModal = (content) => { | ||||||||
| const div = document.createElement('div'); | ||||||||
| div.classList.add('modal'); | ||||||||
| const container = document.createElement('div'); | ||||||||
|
||||||||
| const container = document.createElement('div'); | |
| const container = document.createElement('div'); | |
| container.classList.add('modal-container'); |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removeChild call could throw an error if the element has already been removed from the DOM. Consider using div.remove() or checking if the parent exists before removal.
| document.body.removeChild(div); | |
| div.remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No null check for
videoTrackbefore accessingonended. IfgetVideoTracks()returns an empty array, this will throw an error when trying to setonendedonundefined.