Skip to content

Instantly share code, notes, and snippets.

View gotbahn's full-sized avatar
🐙

Bogdan Plieshka gotbahn

🐙
View GitHub Profile
.component {
background: #000 url(image.png) no-repeat left top;
}
/**
* KEY: "control_watch"
* MESSAGE: "Watch"
*
* @returns {string}
* @see https://webtranslateit.com/en/projects/.../locales/en..en/strings?s=control.watch
*/
export const controlWatch = () => translate('@app.control.watch');
/**
{
"control.cancel": "Abbrechen",
"date.days.full": {
"one": "{{count}} Tag",
"other": "{{count}} Tage"
},
...
{
"locale": "de-formal",
"i18n": {
"control": {
"cancel": {
"message": "Abbrechen"
}
},
"date": {
"days": {
{
common: {
name: 'common',
key: 'proj...jYr',
wtiID: 11468,
depends: [],
},
app: {
name: 'app',
key: 'proj...KfN',
@gotbahn
gotbahn / index.js
Created March 7, 2020 13:20
Media Session. Control Position
if (window.navigator.mediaSession?.setPositionState) {
window.navigator.mediaSession.setPositionState({
duration: /* duration in seconds */,
position: /* position from 0 in seconds */,
playbackRate: 1,
});
}
@gotbahn
gotbahn / index.js
Created March 7, 2020 13:08
Media Session. Next & Previous
// to add playlist action handlers
if (/* has playlist */) {
window.navigator.mediasSession.setActionHandler('nexttrack', () => { /* your next item */ });
window.navigator.mediasSession.setActionHandler('previoustrack', () => { /* your previous item */ });
}
// to cancel playlist action handlers
window.navigator.mediasSession.setActionHandler('nexttrack', null);
window.navigator.mediasSession.setActionHandler('previoustrack', null);
@gotbahn
gotbahn / index.js
Last active March 31, 2020 11:48
Media Session. Play & pause action handlers
// to add seek action handlers
if (/* can seek backward */) {
window.navigator.mediasSession.setActionHandler('seekbackward', () => { /* your seek backward */ });
}
if (/* can seek forward */) {
window.navigator.mediasSession.setActionHandler('seekforward', () => { /* your seek forward */ });
}
// to cancel seek action handlers
window.navigator.mediasSession.setActionHandler('seekbackward', null);
@gotbahn
gotbahn / index.js
Last active March 31, 2020 11:48
Media Session. Play & pause action handlers
// to set action handlers
window.navigator.mediasSession.setActionHandler('play', () => { /* your play */ });
window.navigator.mediasSession.setActionHandler('pause', () => { /* your pause */ });
// to reset action handlers
window.navigator.mediasSession.setActionHandler('play', null);
window.navigator.mediasSession.setActionHandler('pause', null);
// handlers like action & pause have defaults, to cancel them you can use noop function
window.navigator.mediasSession.setActionHandler('play', () => {});
@gotbahn
gotbahn / index.js
Created March 7, 2020 11:26
Media Session. Artwork
window.navigator.mediaSession.metadata = new window.MediaMetadata({
// ...
artwork: [
{
sizes: '128x128',
src: 'https://images.zattoo.com/9e746/128x128.jpg',
type: 'image/jpeg',
},
{
sizes: '256x256',