Skip to content

Commit

Permalink
fix(ADA-1988): [ORS] - Playlist items - duration not read aloud by sc…
Browse files Browse the repository at this point in the history
…reen reader (#71)

Adding the video duration on aria-label of each playlist item.
Using getDurationAsText from ui to get the duration with hour/minute/second

solves ADA-1988
  • Loading branch information
Tzipi-kaltura authored Jan 6, 2025
1 parent 81d0f8d commit f0c385b
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 279 deletions.
3 changes: 1 addition & 2 deletions cypress/e2e/playlist.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-expect-error Module '"@playkit-js/kaltura-player-js"' has no exported member 'core'
import {core} from '@playkit-js/kaltura-player-js';
import {mockKalturaBe, loadPlayer, MANIFEST, MANIFEST_SAFARI} from './env';

Expand Down Expand Up @@ -49,7 +48,7 @@ describe('Playlist plugin', () => {
cy.get('[data-testid="playlist_title"]').should('exist');
cy.get('[data-testid="playlist_title"]').should('have.text', 'new playlist');
cy.get('[data-testid="playlist_duration"]').should('exist');
cy.get('[data-testid="playlist_duration"]').should('have.text', '3 videos, 34 min 16 sec');
cy.get('[data-testid="playlist_duration"]').should('have.text', '3 videos, 17 min 27 sec');
});
});
it('should render 3 playlist items', () => {
Expand Down
7 changes: 6 additions & 1 deletion cypress/fixtures/playlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,10 @@
"thumbnailUrl": "https://cfvod.kaltura.com/p/27017/sp/2701700/thumbnail/entry_id/1_l4h9vq7r/version/100001",
"objectType": "KalturaMediaEntry"
}
]
],
{
"objectType": "KalturaUserEntryListResponse",
"objects": [],
"totalCount": 0
}
]
113 changes: 32 additions & 81 deletions cypress/public/ui-conf.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"prettier:fix": "prettier --write ."
},
"devDependencies": {
"@playkit-js/kaltura-player-js": "3.17.5",
"@playkit-js/kaltura-player-js": "3.17.31",
"conventional-github-releaser": "3.1.3",
"cross-env": "^7.0.3",
"css-loader": "^6.7.1",
Expand All @@ -43,7 +43,7 @@
"webpack-dev-server": "^4.9.0"
},
"peerDependencies": {
"@playkit-js/kaltura-player-js": "^3.14.3-canary.0-99a98cb"
"@playkit-js/kaltura-player-js": "3.17.31"
},
"publishConfig": {
"access": "public"
Expand All @@ -64,7 +64,7 @@
},
"dependencies": {
"@playkit-js/common": "1.5.17",
"@playkit-js/playkit-js-ui": "^0.77.3",
"@playkit-js/ui-managers": "^1.3.11"
"@playkit-js/playkit-js-ui": "0.79.16",
"@playkit-js/ui-managers": "1.6.3"
}
}
14 changes: 10 additions & 4 deletions src/components/playlist-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {KalturaViewHistoryUserEntry, KalturaBaseEntry, Capabilities} from '../..
const {withText, Text} = KalturaPlayer.ui.preacti18n;
const {Icon} = KalturaPlayer.ui.components;
const {toHHMMSS} = KalturaPlayer.ui.utils;
//@ts-ignore
const {getDurationAsText} = KalturaPlayer.ui.utils
const {withPlayer} = KalturaPlayer.ui.components;

const PLACEHOLDER_IMAGE_SRC =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAYAAAA6yNxSAAAAJklEQVR42u3OMQEAAAgDoJnc6BpjDyRgLrcpGgEBAQEBAQGBduABaVYs3Q5APwQAAAAASUVORK5CYII=';
Expand All @@ -23,7 +26,8 @@ const translates = ({}: PlaylistItemProps) => {
document: <Text id="playlist.document_type">Document</Text>,
toPlayAreaLabel: <Text id="playlist.play-item-area-label">Click to play:</Text>,
currentlyPlaying: <Text id="playlist.currently-playing">Currently playing:</Text>,
playlistItemIndex: <Text id="playlist.playlist-item-index">Playlist item #</Text>
playlistItemIndex: <Text id="playlist.playlist-item-index">Playlist item #</Text>,
duration: <Text id="playlist.duration">duration</Text>
};
};

Expand All @@ -41,6 +45,8 @@ interface PlaylistItemProps {
toPlayAreaLabel?: string;
currentlyPlaying?: string;
playlistItemIndex?: string;
duration?: string;
player: any
}

const MediaTypes = {
Expand All @@ -49,7 +55,7 @@ const MediaTypes = {
Document: core.MediaType.DOCUMENT
};

export const PlaylistItem = withText(translates)(({item, active, onSelect, pluginMode, viewHistory, baseEntry, ...otherProps}: PlaylistItemProps) => {
export const PlaylistItem = withPlayer(withText(translates)(({item, active, onSelect, pluginMode, viewHistory, baseEntry, ...otherProps}: PlaylistItemProps) => {
const {sources, index} = item;
const playlistItemIndex = index + 1;
const playlistItemName = sources.metadata?.name;
Expand Down Expand Up @@ -161,7 +167,7 @@ export const PlaylistItem = withText(translates)(({item, active, onSelect, plugi
<div
title={`${otherProps.playlistItemIndex}${index + 1}. ${
active ? otherProps.currentlyPlaying : otherProps.toPlayAreaLabel
} ${playlistItemName}`}
} ${playlistItemName} ${otherProps.duration}: ${getDurationAsText(sources.duration, otherProps.player.config.ui.locale)}`}
className={[
styles.playlistItem,
pluginMode === PluginPositions.VERTICAL ? styles.vertical : styles.horizontal,
Expand All @@ -186,4 +192,4 @@ export const PlaylistItem = withText(translates)(({item, active, onSelect, plugi
</div>
</A11yWrapper>
);
});
}));
1 change: 0 additions & 1 deletion src/playlist.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {h} from 'preact';
// @ts-expect-error Module '"@playkit-js/kaltura-player-js"' has no exported member 'core'
import {ui, core} from '@playkit-js/kaltura-player-js';
import {OnClickEvent} from '@playkit-js/common/dist/hoc/a11y-wrapper';
import {UpperBarManager, SidePanelsManager} from '@playkit-js/ui-managers';
Expand Down
3 changes: 2 additions & 1 deletion translations/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"document_type": "Document",
"play-item-area-label": "Click to play:",
"currently-playing": "Currently playing:",
"playlist-item-index": "Playlist item #"
"playlist-item-index": "Playlist item #",
"duration": "duration"
}
}
}
Loading

0 comments on commit f0c385b

Please sign in to comment.