mikedmor / OctoPrint_MultiCam

Extends the Control tab of OctoPrint, allowing the ability to switch between multiple webcam feeds.
45 stars 19 forks source link

Switching between cams on Safari does not work #32

Closed nibty closed 1 year ago

nibty commented 3 years ago

Only the default cam works on Safari. Click the button for other cams does nothing.

OS: Mac OS 11.0.1 (20B29) Browser: Safari Version 14.0.1 (16610.2.11.51.8)

HDRI00 commented 3 years ago

I second this problem.

OS: Mac 10.14.6 Browser: Safari Version 14.0.1 (14610.2.11.51.10)

spatcho commented 3 years ago

Same here, Big Sur x86, doesn't work on Safari, work on Chrome and Firefox, octopi and plugins up to date.

nibty commented 3 years ago

I found the origin of this issue in the Octoprint code. Removing the following block of code fixes the problem.

https://github.com/OctoPrint/OctoPrint/blob/f67c15a9a47794a68be9aed4f2d5a12a87e70179/src/octoprint/static/js/app/viewmodels/control.js#L684-L687

// safari bug doesn't release the mjpeg stream, so we just set it up the once
if (OctoPrint.coreui.browser.safari && currentSrc != undefined) {
    return;
}

Here's a discussion on returning the functionality https://community.octoprint.org/t/mjpeg-streaming-in-safari-possible-improvements/16064

victor7376 commented 3 years ago

Just to inform, this also is a fix if you’re using an iPad.

rshartog commented 3 years ago

Confirmed that this is still an issue in OctoPi Version 0.18.0; OctoPrint Version 1.6.1. Switching cameras in OctoPrint works for me in Chrome, but did not work in Safari. Commented lines 684-687 as mentioned by nifty above, reloaded OctoPrint, and camera switching works in Safari. Thanks for finding this. I spent hours trying to understand why I could see my cameras with local URLs and full URLs, but the MultiCam buttons on the Control tab would only ever show the first camera (in Safari). I never thought to try another browser.

appleimperio commented 2 years ago

I'm having the same problem, where is the file I need to edit?

Thanks

victor7376 commented 2 years ago

I'm having the same problem, where is the file I need to edit?

Thanks

Location:

/home/pi/oprint/lib/python3.7/site-packages/octoprint/static/js/app/viewmodels/

appleimperio commented 2 years ago

Thank you. I can't find but I think it's because im using a docker container!

victor7376 commented 2 years ago

Thank you. I can't find but I think it's because im using a docker container!

Just look for control.js then look for the line regarding safari.

appleimperio commented 2 years ago

Found it. just in case someone in Docker came looking for it the path of the control.js file is:

/usr/local/lib/python3.8/site-packages/octoprint/static/js/app/viewmodels/

Thank you again it work great!

levydanqc commented 1 year ago

Why hasn't this fix been merged ? It is quite annoying as commenting these lines fix the problem...

victor7376 commented 1 year ago

Why hasn't this fix been merged ? It is quite annoying as commenting these lines fix the problem...

Never understand why they never remove it, I keep having to remember to remove it for my octoprint to work.

mikedmor commented 1 year ago

Fixed in version 0.4.0rc3