Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MBetterc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mbetter
MBetterc
Commits
d4927b64
Commit
d4927b64
authored
Dec 04, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed crashes
parent
89aa1260
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
697 additions
and
12 deletions
+697
-12
player.py
mbetterclient/qt_player/player.py
+16
-0
web_player.html
mbetterclient/qt_player/web_player_assets/web_player.html
+1
-1
web_player.js
mbetterclient/qt_player/web_player_assets/web_player.js
+98
-1
routes.py
mbetterclient/web_dashboard/routes.py
+582
-10
No files found.
mbetterclient/qt_player/player.py
View file @
d4927b64
...
@@ -1998,6 +1998,22 @@ class WebPlayerWindow(QMainWindow):
...
@@ -1998,6 +1998,22 @@ class WebPlayerWindow(QMainWindow):
def
setup_web_player
(
self
):
def
setup_web_player
(
self
):
"""Setup web player with QWebEngineView"""
"""Setup web player with QWebEngineView"""
# Configure web engine settings to allow autoplay
from
PyQt6.QtWebEngineCore
import
QWebEngineSettings
settings
=
self
.
web_player_view
.
settings
()
settings
.
setAttribute
(
QWebEngineSettings
.
WebAttribute
.
PlaybackRequiresUserGesture
,
False
)
settings
.
setAttribute
(
QWebEngineSettings
.
WebAttribute
.
AllowRunningInsecureContent
,
True
)
settings
.
setAttribute
(
QWebEngineSettings
.
WebAttribute
.
AllowGeolocationOnInsecureOrigins
,
True
)
settings
.
setAttribute
(
QWebEngineSettings
.
WebAttribute
.
LocalContentCanAccessRemoteUrls
,
True
)
settings
.
setAttribute
(
QWebEngineSettings
.
WebAttribute
.
LocalContentCanAccessFileUrls
,
True
)
logger
.
info
(
"Configured web engine settings to allow autoplay and local content"
)
# Configure web engine profile for local file access
profile
=
self
.
web_player_view
.
page
()
.
profile
()
profile
.
setHttpCacheType
(
QWebEngineProfile
.
HttpCacheType
.
NoCache
)
profile
.
setPersistentCookiesPolicy
(
QWebEngineProfile
.
PersistentCookiesPolicy
.
NoPersistentCookies
)
logger
.
info
(
"Configured web engine profile for local file access"
)
# Get web player HTML path
# Get web player HTML path
web_player_html_path
=
self
.
_get_web_player_html_path
()
web_player_html_path
=
self
.
_get_web_player_html_path
()
...
...
mbetterclient/qt_player/web_player_assets/web_player.html
View file @
d4927b64
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,7 @@
<body>
<body>
<!-- Video container -->
<!-- Video container -->
<div
class=
"video-container"
>
<div
class=
"video-container"
>
<video
id=
"webVideoPlayer"
controls
autoplay
playsinline
>
<video
id=
"webVideoPlayer"
controls
playsinline
muted
>
<source
src=
""
type=
"video/mp4"
>
<source
src=
""
type=
"video/mp4"
>
Your browser does not support the video tag.
Your browser does not support the video tag.
</video>
</video>
...
...
mbetterclient/qt_player/web_player_assets/web_player.js
View file @
d4927b64
...
@@ -191,6 +191,26 @@ class WebPlayerAPI {
...
@@ -191,6 +191,26 @@ class WebPlayerAPI {
console
.
log
(
'Video readyState:'
,
this
.
videoElement
.
readyState
);
console
.
log
(
'Video readyState:'
,
this
.
videoElement
.
readyState
);
console
.
log
(
'Video networkState:'
,
this
.
videoElement
.
networkState
);
console
.
log
(
'Video networkState:'
,
this
.
videoElement
.
networkState
);
console
.
log
(
'Video error:'
,
this
.
videoElement
.
error
);
console
.
log
(
'Video error:'
,
this
.
videoElement
.
error
);
// For debug mode, ensure video is visible and properly sized
if
(
window
.
location
.
href
.
includes
(
'debug'
)
||
window
.
location
.
href
.
includes
(
'debug-player'
))
{
console
.
log
(
'DEBUG MODE: Ensuring video visibility'
);
this
.
videoElement
.
style
.
display
=
'block'
;
this
.
videoElement
.
style
.
visibility
=
'visible'
;
this
.
videoElement
.
style
.
opacity
=
'1'
;
this
.
videoElement
.
style
.
width
=
'100%'
;
this
.
videoElement
.
style
.
height
=
'100%'
;
this
.
videoElement
.
style
.
objectFit
=
'contain'
;
// Force video element to be visible in debug mode
const
videoContainer
=
document
.
querySelector
(
'.video-container'
);
if
(
videoContainer
)
{
videoContainer
.
style
.
display
=
'block'
;
videoContainer
.
style
.
visibility
=
'visible'
;
videoContainer
.
style
.
opacity
=
'1'
;
videoContainer
.
style
.
zIndex
=
'100'
;
}
}
}
}
// Attempt playback with autoplay policy handling
// Attempt playback with autoplay policy handling
...
@@ -201,9 +221,21 @@ class WebPlayerAPI {
...
@@ -201,9 +221,21 @@ class WebPlayerAPI {
if
(
this
.
videoElement
.
readyState
>=
HTMLMediaElement
.
HAVE_FUTURE_DATA
)
{
if
(
this
.
videoElement
.
readyState
>=
HTMLMediaElement
.
HAVE_FUTURE_DATA
)
{
console
.
log
(
'Video ready, attempting playback...'
);
console
.
log
(
'Video ready, attempting playback...'
);
// For debug mode, ensure video is visible before attempting playback
if
(
window
.
location
.
href
.
includes
(
'debug'
)
||
window
.
location
.
href
.
includes
(
'debug-player'
))
{
console
.
log
(
'DEBUG MODE: Ensuring video is visible before playback'
);
this
.
videoElement
.
style
.
display
=
'block'
;
this
.
videoElement
.
style
.
visibility
=
'visible'
;
this
.
videoElement
.
style
.
opacity
=
'1'
;
}
// Try to play with autoplay policy handling
// Try to play with autoplay policy handling
this
.
videoElement
.
play
().
then
(()
=>
{
this
.
videoElement
.
play
().
then
(()
=>
{
console
.
log
(
'Playback started successfully'
);
console
.
log
(
'Playback started successfully'
);
// Ensure video is visible after successful playback
this
.
videoElement
.
style
.
display
=
'block'
;
this
.
videoElement
.
style
.
visibility
=
'visible'
;
this
.
videoElement
.
style
.
opacity
=
'1'
;
}).
catch
(
e
=>
{
}).
catch
(
e
=>
{
console
.
error
(
'Playback failed (likely due to autoplay policy):'
,
e
);
console
.
error
(
'Playback failed (likely due to autoplay policy):'
,
e
);
...
@@ -211,6 +243,14 @@ class WebPlayerAPI {
...
@@ -211,6 +243,14 @@ class WebPlayerAPI {
this
.
videoElement
.
controls
=
true
;
this
.
videoElement
.
controls
=
true
;
this
.
videoElement
.
muted
=
true
;
// Muted videos can often autoplay
this
.
videoElement
.
muted
=
true
;
// Muted videos can often autoplay
// For debug mode, ensure video is visible even if autoplay fails
if
(
window
.
location
.
href
.
includes
(
'debug'
)
||
window
.
location
.
href
.
includes
(
'debug-player'
))
{
console
.
log
(
'DEBUG MODE: Forcing video visibility despite autoplay block'
);
this
.
videoElement
.
style
.
display
=
'block'
;
this
.
videoElement
.
style
.
visibility
=
'visible'
;
this
.
videoElement
.
style
.
opacity
=
'1'
;
}
// Try again with muted
// Try again with muted
this
.
videoElement
.
play
().
catch
(
e2
=>
{
this
.
videoElement
.
play
().
catch
(
e2
=>
{
console
.
error
(
'Muted playback also failed:'
,
e2
);
console
.
error
(
'Muted playback also failed:'
,
e2
);
...
@@ -219,6 +259,13 @@ class WebPlayerAPI {
...
@@ -219,6 +259,13 @@ class WebPlayerAPI {
});
});
}
else
{
}
else
{
console
.
log
(
'Video not ready yet, waiting for more data...'
);
console
.
log
(
'Video not ready yet, waiting for more data...'
);
// For debug mode, ensure video is visible even while waiting
if
(
window
.
location
.
href
.
includes
(
'debug'
)
||
window
.
location
.
href
.
includes
(
'debug-player'
))
{
console
.
log
(
'DEBUG MODE: Ensuring video is visible while waiting for data'
);
this
.
videoElement
.
style
.
display
=
'block'
;
this
.
videoElement
.
style
.
visibility
=
'visible'
;
this
.
videoElement
.
style
.
opacity
=
'1'
;
}
}
}
}
}
...
@@ -325,4 +372,54 @@ document.addEventListener('DOMContentLoaded', function() {
...
@@ -325,4 +372,54 @@ document.addEventListener('DOMContentLoaded', function() {
console
.
log
(
'Web Player API initialized and exposed to window.webPlayer'
);
console
.
log
(
'Web Player API initialized and exposed to window.webPlayer'
);
console
.
log
(
'Global functions playVideo and updateOverlayData exposed for WebChannel'
);
console
.
log
(
'Global functions playVideo and updateOverlayData exposed for WebChannel'
);
// Initialize debug mode if detected
if
(
window
.
location
.
href
.
includes
(
'debug'
)
||
window
.
location
.
href
.
includes
(
'debug-player'
))
{
console
.
log
(
'DEBUG MODE DETECTED: Applying debug-specific video fixes'
);
webPlayer
.
_initDebugMode
();
}
});
});
// Add debug mode initialization method to WebPlayerAPI prototype
WebPlayerAPI
.
prototype
.
_initDebugMode
=
function
()
{
console
.
log
(
'Initializing debug mode for web player'
);
// Ensure video element is visible in debug mode
if
(
this
.
videoElement
)
{
this
.
videoElement
.
style
.
display
=
'block'
;
this
.
videoElement
.
style
.
visibility
=
'visible'
;
this
.
videoElement
.
style
.
opacity
=
'1'
;
this
.
videoElement
.
style
.
width
=
'100%'
;
this
.
videoElement
.
style
.
height
=
'100%'
;
this
.
videoElement
.
style
.
objectFit
=
'contain'
;
this
.
videoElement
.
muted
=
true
;
// Ensure muted for autoplay in debug mode
// Force video container to be visible
const
videoContainer
=
document
.
querySelector
(
'.video-container'
);
if
(
videoContainer
)
{
videoContainer
.
style
.
display
=
'block'
;
videoContainer
.
style
.
visibility
=
'visible'
;
videoContainer
.
style
.
opacity
=
'1'
;
videoContainer
.
style
.
zIndex
=
'100'
;
}
// Add debug overlay to indicate debug mode
const
debugOverlay
=
document
.
createElement
(
'div'
);
debugOverlay
.
style
.
position
=
'absolute'
;
debugOverlay
.
style
.
top
=
'10px'
;
debugOverlay
.
style
.
right
=
'10px'
;
debugOverlay
.
style
.
backgroundColor
=
'rgba(255, 0, 0, 0.7)'
;
debugOverlay
.
style
.
color
=
'white'
;
debugOverlay
.
style
.
padding
=
'5px 10px'
;
debugOverlay
.
style
.
borderRadius
=
'5px'
;
debugOverlay
.
style
.
fontFamily
=
'Arial, sans-serif'
;
debugOverlay
.
style
.
fontSize
=
'14px'
;
debugOverlay
.
style
.
zIndex
=
'1000'
;
debugOverlay
.
textContent
=
'DEBUG MODE - Video Player'
;
document
.
body
.
appendChild
(
debugOverlay
);
console
.
log
(
'Debug mode initialization completed'
);
}
else
{
console
.
error
(
'DEBUG MODE: Video element not available for debug initialization'
);
}
};
\ No newline at end of file
mbetterclient/web_dashboard/routes.py
View file @
d4927b64
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment