-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor(bbb): Work in progress on BigPlayButton customization in Shaka Player (#8045) #8092
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we want to add this as is, I think it should be more customizable. @tykus160 any opinion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any suggestions to take into consideration ? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Shaka Player Layout Manager Demo</title> | ||
<link rel="shortcut icon" href="#"> | ||
<link rel="stylesheet" type="text/css" href="dist/controls.css"> | ||
<script src="dist/shaka-player.ui.debug.js"></script> | ||
<style> | ||
.video-container { | ||
max-width: 800px; | ||
margin: 20px auto; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<div class="video-container"> | ||
<video id="video" width="100%" poster="//shaka-player-demo.appspot.com/assets/poster.jpg"></video> | ||
</div> | ||
|
||
<div class="config-panel"> | ||
<h3>Layout Themes</h3> | ||
<button class="theme-default" onclick="applyDefaultTheme()">Default Theme</button> | ||
</div> | ||
|
||
<script> | ||
const manifestUri = "https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"; | ||
let video; | ||
let player; | ||
let ui; | ||
|
||
async function init() { | ||
// Check if the browser supports the player | ||
const supported = await shaka.Player.isBrowserSupported(); | ||
if (!supported) { | ||
console.error('Browser not supported!'); | ||
return; | ||
} | ||
|
||
// Get the video element | ||
video = document.getElementById('video'); | ||
|
||
// Initialize the player | ||
player = new shaka.Player(video); | ||
|
||
// Initialize the UI | ||
ui = new shaka.ui.Overlay(player, video.parentElement, video); | ||
|
||
// Listen to error events | ||
player.addEventListener('error', onPlayerErrorEvent); | ||
|
||
try { | ||
// Load the manifest | ||
await player.load(manifestUri); | ||
|
||
// Set start time to 30 seconds | ||
video.currentTime = 30; | ||
|
||
console.log('Video loaded successfully'); | ||
} catch (error) { | ||
console.error('Error code', error.code, 'object', error); | ||
} | ||
} | ||
|
||
function onPlayerErrorEvent(event) { | ||
console.error('Player error:', event.detail); | ||
} | ||
|
||
function onUIErrorEvent(event) { | ||
console.error('UI error:', event); | ||
} | ||
|
||
function applyDefaultTheme() { | ||
try { | ||
console.log('Applying default theme...'); | ||
const controls = ui.getControls(); | ||
if (!controls) { | ||
console.error('Controls not initialized'); | ||
return; | ||
} | ||
|
||
// Update UI configuration directly | ||
ui.configure({ | ||
controlPanelElements: [ | ||
'play_pause', | ||
'spacer', | ||
'mute', | ||
'volume', | ||
'time_and_duration', | ||
'overflow_menu' | ||
], | ||
overflowMenuButtons: [ | ||
'captions', | ||
'playback_rate', | ||
'quality' | ||
], | ||
addSeekBar: true, | ||
showBackward: true, | ||
showForward: true, | ||
showTimeText: true, | ||
showPlayPauseBtn: true, | ||
showFullScreen: true, | ||
showProgressBar: true, | ||
showQualityControl: true, | ||
addBigPlayButton: true, | ||
showSpeedControl: true, | ||
primaryColor: "#00ff00", | ||
seekBarColors: { | ||
base: '#e0e0e0', | ||
buffered: '#a0a0a0', | ||
played: '#00ff00', | ||
adBreaks: '#ff0000' | ||
}, | ||
bigPlayButtonColor: "#00ff00", | ||
playbackRates: [0.5, 1], | ||
skipDuration: 10, | ||
initialPlayButtonShape: 'Square', | ||
buttonShape: 'Square' | ||
}); | ||
|
||
// Additional direct style application for big play button | ||
const container = video.parentElement; | ||
const bigPlayButton = container.querySelector('.shaka-big-play-button'); | ||
if (bigPlayButton) { | ||
bigPlayButton.style.setProperty('background-color', '#00ff00', 'important'); | ||
console.log('Big play button color applied directly'); | ||
} else { | ||
console.warn('Big play button not found'); | ||
} | ||
|
||
console.log('Default theme applied successfully'); | ||
} catch (error) { | ||
console.error('Error applying default theme:', error); | ||
} | ||
} | ||
|
||
|
||
|
||
// Wait for DOM content to load before initializing | ||
if (document.readyState === 'loading') { | ||
document.addEventListener('DOMContentLoaded', init); | ||
} else { | ||
init(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ | |
"build": "python build/all.py", | ||
"prepack": "clean-package", | ||
"postpack": "clean-package restore", | ||
"prepublishOnly": "python build/checkversion.py && python build/all.py --force" | ||
"prepublishOnly": "python3 build/all.py --force" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? We have npm run build :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just creating this PR to inform that work is in progress. Still working on it, and I'll update it soon. |
||
}, | ||
"dependencies": { | ||
"eme-encryption-scheme-polyfill": "^2.2.1" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/*! @license | ||
* Shaka Player | ||
* Copyright 2016 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @externs | ||
* @suppress {duplicate} | ||
*/ | ||
|
||
/** | ||
* @typedef {{ | ||
* playerName: string, | ||
* controlPanelElements: !Array<string>, | ||
* addSeekBar: boolean, | ||
* overflowMenuButtons: !Array<string>, | ||
* confirmBeforeAutoResume: boolean, | ||
* enableAirPlay: boolean, | ||
* enableAutoResumeLocal: boolean, | ||
* enableChromecast: boolean, | ||
* enableChapters: boolean, | ||
* addBigPlayButton: boolean, | ||
* enableDoubleTapSkip: boolean, | ||
* enableKeyboardShortcuts: boolean, | ||
* enableLockControls: boolean, | ||
* enablePiP: boolean, | ||
* enableReportBug: boolean, | ||
* enableSaveOffline: boolean, | ||
* hideControlsOnPause: boolean, | ||
* playbackRates: !Array<string>, | ||
* primaryColor: string, | ||
* showCaptionsControl: boolean, | ||
* showFullScreen: boolean, | ||
* showPlayPauseBtn: boolean, | ||
* showProgressBar: boolean, | ||
* showQualityControl: boolean, | ||
* showReplayAtEnd: boolean, | ||
* showScrubbingPreview: boolean, | ||
* showSpeedControl: boolean, | ||
* showTimeText: boolean, | ||
* skipDuration: number, | ||
* conserveVolumeAcrossSession: boolean, | ||
* conserveSpeedAcrossSession: boolean, | ||
* conserveQualityAcrossSession: boolean, | ||
* conserveSelectedCaptionLanguage: boolean, | ||
* initialPlayButtonShape: string, | ||
* initialDurationPosition: string, | ||
* buttonShape: string, | ||
* seekBarColors: { | ||
* base: string, | ||
* buffered: string, | ||
* played: string, | ||
* adBreaks: string | ||
* }, | ||
* enableTooltips: boolean, | ||
* collapseInSettings: !Array<string>, | ||
* bigPlayButtonColor: string | ||
* }} | ||
* | ||
* @description | ||
* Configuration options for the LayoutManager. | ||
* | ||
* @property {string} playerName | ||
* The name of the player instance. | ||
* @property {!Array<string>} controlPanelElements | ||
* List of UI elements to display in the control panel. | ||
* @property {boolean} addSeekBar | ||
* Whether to add a seek bar to the control panel. | ||
* @property {!Array<string>} overflowMenuButtons | ||
* List of buttons to display in the overflow menu. | ||
* @property {boolean} confirmBeforeAutoResume | ||
* Whether to confirm before auto-resuming playback. | ||
* @property {boolean} enableAirPlay | ||
* Whether to enable AirPlay support. | ||
* @property {boolean} enableAutoResumeLocal | ||
* Whether to enable local auto-resume. | ||
* @property {!Array<string>} playbackRates | ||
* List of available playback rates. | ||
* @property {string} primaryColor | ||
* Primary color for UI elements. | ||
* @property {string} initialPlayButtonShape | ||
* Shape of the initial play button ('Circle' or 'Square'). | ||
* @property {string} initialDurationPosition | ||
* Position of the duration display. | ||
* @property {string} buttonShape | ||
* Shape of the play button ('Circle' or 'Square'). | ||
* @property {{ | ||
* base: string, | ||
* buffered: string, | ||
* played: string, | ||
* adBreaks: string | ||
* }} seekBarColors Colors for the seek bar. | ||
* @property {boolean} enableTooltips | ||
* Whether to enable tooltips. | ||
* @property {!Array<string>} collapseInSettings | ||
* List of settings to collapse in the settings menu. | ||
* @property {string} bigPlayButtonColor | ||
* Color of the big play button. | ||
* @exportDoc | ||
*/ | ||
shaka.ui.LayoutManager.Options; |
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.
Please, we are trying to remain alphabetical order