bitmovin-player-ui
Advanced tools
Comparing version 3.23.0 to 3.24.0
@@ -7,2 +7,7 @@ # Change Log | ||
## [3.24.0] - 2021-02-16 | ||
### Added | ||
- Support for `PlaylistTransition` event which is only present on Mobile V3 | ||
## [3.23.0] - 2021-01-14 | ||
@@ -706,2 +711,4 @@ | ||
[3.24.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.23.0...v3.24.0 | ||
[3.23.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.22.0...v3.23.0 | ||
[3.22.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.21.0...v3.22.0 | ||
@@ -708,0 +715,0 @@ [3.21.0]: https://github.com/bitmovin/bitmovin-player-ui/compare/v3.20.0...v3.21.0 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '3.23.0'; | ||
exports.version = '3.24.0'; | ||
// Management | ||
@@ -6,0 +6,0 @@ var uimanager_1 = require("./uimanager"); |
@@ -96,7 +96,13 @@ "use strict"; | ||
updateConfig(); | ||
// Update the configuration when a new source is loaded | ||
this.managerPlayerWrapper.getPlayer().on(this.player.exports.PlayerEvent.SourceLoaded, function () { | ||
// Update the source configuration when a new source is loaded and dispatch onUpdated | ||
var updateSource = function () { | ||
updateConfig(); | ||
_this.config.events.onUpdated.dispatch(_this); | ||
}); | ||
}; | ||
this.managerPlayerWrapper.getPlayer().on(this.player.exports.PlayerEvent.SourceLoaded, updateSource); | ||
// The PlaylistTransition event is only available on Mobile v3 for now. | ||
// This event is fired when a new source becomes active in the player. | ||
if (this.player.exports.PlayerEvent.PlaylistTransition) { | ||
this.managerPlayerWrapper.getPlayer().on(this.player.exports.PlayerEvent.PlaylistTransition, updateSource); | ||
} | ||
if (uiconfig.container) { | ||
@@ -103,0 +109,0 @@ // Unfortunately "uiContainerElement = new DOM(config.container)" will not accept the container with |
{ | ||
"name": "bitmovin-player-ui", | ||
"version": "3.23.0", | ||
"version": "3.24.0", | ||
"description": "Bitmovin Player UI Framework", | ||
@@ -55,2 +55,2 @@ "main": "./dist/js/framework/main.js", | ||
} | ||
} | ||
} |
@@ -367,2 +367,9 @@ import { | ||
} | ||
firePlaylistTransitionEvent(): void { | ||
this.fireEvent<any>({ | ||
timestamp: Date.now(), | ||
type: 'playlisttransition', | ||
}); | ||
} | ||
} |
@@ -1,4 +0,7 @@ | ||
import { PlayerWrapper } from '../src/ts/uimanager'; | ||
import { InternalUIConfig, PlayerWrapper, UIManager } from '../src/ts/uimanager'; | ||
import { PlayerAPI } from 'bitmovin-player'; | ||
import { MockHelper, TestingPlayerAPI } from './helper/MockHelper'; | ||
jest.mock('../src/ts/dom'); | ||
// This just simulates a Class that can be wrapped by our PlayerWrapper. | ||
@@ -65,2 +68,43 @@ // To enable this simple class structure we need a lot of any casts in the tests. | ||
}); | ||
describe('mobile v3 handling', () => { | ||
let playerMock: TestingPlayerAPI; | ||
beforeEach(() => { | ||
playerMock = MockHelper.getPlayerMock(); | ||
// disable HTML element interactions | ||
UIManager.prototype.switchToUiVariant = jest.fn(); | ||
}); | ||
describe('when a PlaylistTransition event is part of PlayerEvent', () => { | ||
beforeEach(() => { | ||
(playerMock.exports.PlayerEvent as any).PlaylistTransition = 'playlisttransition'; | ||
}); | ||
it('attaches the listener', () => { | ||
const onSpy = jest.spyOn(playerMock, 'on'); | ||
new UIManager(playerMock, MockHelper.generateDOMMock() as any); | ||
expect(onSpy).toHaveBeenCalledWith('playlisttransition', expect.any(Function)); | ||
}); | ||
describe('and a PlaylistTransition event occurs', () => { | ||
it('dispatches onUpdated', () => { | ||
const uiManager = new UIManager(playerMock, MockHelper.generateDOMMock() as any); | ||
let onUpdatedSpy = jest.fn(); | ||
(uiManager.getConfig() as InternalUIConfig).events.onUpdated.subscribe(onUpdatedSpy); | ||
playerMock.eventEmitter.firePlaylistTransitionEvent(); | ||
expect(onUpdatedSpy).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); | ||
describe('when no PlaylistTransition event is part of PlayerEvent', () => { | ||
beforeEach(() => { | ||
delete (playerMock.exports.PlayerEvent as any).PlaylistTransition; | ||
}); | ||
it('does not attach a listener', () => { | ||
const onSpy = jest.spyOn(playerMock, 'on'); | ||
new UIManager(playerMock, MockHelper.generateDOMMock() as any); | ||
expect(onSpy).not.toHaveBeenCalledWith('playlisttransition', expect.any(Function)); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -187,8 +187,19 @@ import {UIContainer} from './components/uicontainer'; | ||
// Update the configuration when a new source is loaded | ||
this.managerPlayerWrapper.getPlayer().on(this.player.exports.PlayerEvent.SourceLoaded, () => { | ||
// Update the source configuration when a new source is loaded and dispatch onUpdated | ||
const updateSource = () => { | ||
updateConfig(); | ||
this.config.events.onUpdated.dispatch(this); | ||
}); | ||
}; | ||
this.managerPlayerWrapper.getPlayer().on(this.player.exports.PlayerEvent.SourceLoaded, updateSource); | ||
// The PlaylistTransition event is only available on Mobile v3 for now. | ||
// This event is fired when a new source becomes active in the player. | ||
if ((this.player.exports.PlayerEvent as any).PlaylistTransition) { | ||
this.managerPlayerWrapper.getPlayer().on( | ||
(this.player.exports.PlayerEvent as any).PlaylistTransition, | ||
updateSource, | ||
); | ||
} | ||
if (uiconfig.container) { | ||
@@ -195,0 +206,0 @@ // Unfortunately "uiContainerElement = new DOM(config.container)" will not accept the container with |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4333871
48430