Skip to content

Conversation

@bustardcelly
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the user experience for screen sharing functionality on mobile devices by adding informative modal messaging when screen share capture fails, which commonly occurs on mobile browsers that don't support this capability.

  • Added a reusable modal utility function for displaying messages
  • Enhanced error handling in screen share capture functions to show user-friendly messages
  • Added automatic cleanup when screen sharing ends unexpectedly

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
static/script/red5pro-utils.js Added showModal utility function for displaying modal dialogs
src/page/test/publishScreenShare/index.js Enhanced error handling with modal messaging and added video track end event handler
src/page/test/publishScreenShare/index.html Added modal CSS styling
src/page/test/castlabs/index.html Added black background styling to video element
src/page/sm-test/publishStreamManagerProxyScreenShare/index.js Enhanced error handling with modal messaging and added video track end event handler
src/page/sm-test/publishStreamManagerProxyScreenShare/index.html Added modal CSS styling
src/page/sm-test/castlabsStreamManagerProxy/index.html Added black background styling to video element

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

document.body.appendChild(div);
button.addEventListener('click', (event) => {
event.preventDefault();
document.body.removeChild(div);
Copy link

Copilot AI Oct 7, 2025

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.

Suggested change
document.body.removeChild(div);
div.remove();

Copilot uses AI. Check for mistakes.
window.showModal = (content) => {
const div = document.createElement('div');
div.classList.add('modal');
const container = document.createElement('div');
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container element lacks CSS classes or styling which may cause layout issues. Consider adding appropriate CSS classes for proper modal structure.

Suggested change
const container = document.createElement('div');
const container = document.createElement('div');
container.classList.add('modal-container');

Copilot uses AI. Check for mistakes.
Comment on lines +269 to +271
videoTrack.onended = async () => {
if (targetPublisher) {
unpublish(targetPublisher)
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No null check for videoTrack before accessing onended. If getVideoTracks() returns an empty array, this will throw an error when trying to set onended on undefined.

Suggested change
videoTrack.onended = async () => {
if (targetPublisher) {
unpublish(targetPublisher)
if (videoTrack) {
videoTrack.onended = async () => {
if (targetPublisher) {
unpublish(targetPublisher)
}

Copilot uses AI. Check for mistakes.
Comment on lines +270 to +272
videoTrack.onended = async () => {
if (targetPublisher) {
unpublish(targetPublisher)
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No null check for videoTrack before accessing onended. If getVideoTracks() returns an empty array, this will throw an error when trying to set onended on undefined.

Suggested change
videoTrack.onended = async () => {
if (targetPublisher) {
unpublish(targetPublisher)
if (videoTrack) {
videoTrack.onended = async () => {
if (targetPublisher) {
unpublish(targetPublisher)
}

Copilot uses AI. Check for mistakes.
@vitorgaz vitorgaz merged commit 1fcaaf4 into epic/NEWFY Oct 12, 2025
@vitorgaz vitorgaz deleted the bugs/15_0_0_0710 branch October 12, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants