Skip to content

Commit 93c7495

Browse files
authored
Merge pull request #272 from rdkcentral/dev
Dev
2 parents 733603c + 0240ac9 commit 93c7495

File tree

8 files changed

+56
-14
lines changed

8 files changed

+56
-14
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v4.7.0
4+
5+
*20 oct 2021*
6+
7+
- Fixed issues with playing Video as a texture (#189)
8+
- Added (semi private) getter for consumer to VideoPlayer plugin
9+
- Added error handling (by firing an error to the consumer) when play() on the video tag returns an error (with a Promise wrapper fallback for older browsers)
10+
- Added fix that allows periods to be used in a Router hash
11+
312
## v4.6.1
413

514
*30 aug 2021*

docs/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v4.7.0
4+
5+
*20 oct 2021*
6+
7+
- Fixed issues with playing Video as a texture (#189)
8+
- Added (semi private) getter for consumer to VideoPlayer plugin
9+
- Added error handling (by firing an error to the consumer) when play() on the video tag returns an error (with a Promise wrapper fallback for older browsers)
10+
- Added fix that allows periods to be used in a Router hash
11+
312
## v4.6.1
413

514
*30 aug 2021*

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lightningjs/sdk",
3-
"version": "4.6.1",
3+
"version": "4.7.0",
44
"license": "Apache-2.0",
55
"scripts": {
66
"postinstall": "node ./scripts/postinstall.js",
@@ -23,6 +23,7 @@
2323
"dependencies": {
2424
"@babel/polyfill": "^7.11.5",
2525
"@lightningjs/core": "*",
26+
"@michieljs/execute-as-promise": "^1.0.0",
2627
"deepmerge": "^4.2.2",
2728
"localCookie": "github:WebPlatformForEmbedded/localCookie",
2829
"shelljs": "^0.8.4",

package-lock.json

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lightningjs/sdk",
3-
"version": "4.6.1",
3+
"version": "4.7.0",
44
"license": "Apache-2.0",
55
"scripts": {
66
"postinstall": "node ./scripts/postinstall.js",
@@ -23,6 +23,7 @@
2323
"dependencies": {
2424
"@babel/polyfill": "^7.11.5",
2525
"@lightningjs/core": "*",
26+
"@michieljs/execute-as-promise": "^1.0.0",
2627
"deepmerge": "^4.2.2",
2728
"localCookie": "github:WebPlatformForEmbedded/localCookie",
2829
"shelljs": "^0.8.4",

src/Router/utils/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export const getValuesFromHash = (hash = '', path) => {
150150
// we already did the matching part
151151
path = stripRegex(path, '')
152152

153-
const getUrlParts = /(\/?:?[\w%\s:-]+)/g
153+
const getUrlParts = /(\/?:?[\w%\s:.-]+)/g
154154
const hashParts = hash.match(getUrlParts) || []
155155
const routeParts = path.match(getUrlParts) || []
156156
const getNamedGroup = /^\/:([\w-]+)\/?/

src/VideoPlayer/VideoTexture.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,21 @@ export default class VideoTexture extends Lightning.Component {
7474

7575
start() {
7676
const stage = this.stage
77+
this._lastTime = 0
7778
if (!this._updateVideoTexture) {
7879
this._updateVideoTexture = () => {
7980
if (this.videoTexture.options.source && this.videoEl.videoWidth && this.active) {
8081
const gl = stage.gl
8182

8283
const currentTime = new Date().getTime()
84+
const getVideoPlaybackQuality = this.videoEl.getVideoPlaybackQuality()
8385

8486
// When BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_DEBUGUTILS is not set in WPE, webkitDecodedFrameCount will not be available.
8587
// We'll fallback to fixed 30fps in this case.
86-
const frameCount = this.videoEl.webkitDecodedFrameCount
88+
// As 'webkitDecodedFrameCount' is about to deprecate, check for the 'totalVideoFrames'
89+
const frameCount = getVideoPlaybackQuality
90+
? getVideoPlaybackQuality.totalVideoFrames
91+
: this.videoEl.webkitDecodedFrameCount
8792

8893
const mustUpdate = frameCount
8994
? this._lastFrame !== frameCount

src/VideoPlayer/index.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* limitations under the License.
1818
*/
1919

20+
import executeAsPromise from '@michieljs/execute-as-promise'
21+
2022
import Metrics from '../Metrics'
2123
import Log from '../Log'
2224
import Ads from '../Ads'
@@ -233,11 +235,15 @@ const videoPlayerPlugin = {
233235
state.playingAds = true
234236
ads.prerolls().then(() => {
235237
state.playingAds = false
236-
loader(url, videoEl, config).then(() => {
237-
registerEventListeners()
238-
this.show()
239-
this.play()
240-
})
238+
loader(url, videoEl, config)
239+
.then(() => {
240+
registerEventListeners()
241+
this.show()
242+
this.play()
243+
})
244+
.catch(e => {
245+
fireOnConsumer('error', { videoElement: videoEl, event: e })
246+
})
241247
})
242248
})
243249
}
@@ -279,7 +285,9 @@ const videoPlayerPlugin = {
279285
play() {
280286
if (!this.canInteract) return
281287
if (textureMode === true) videoTexture.start()
282-
videoEl.play()
288+
executeAsPromise(videoEl.play, null, videoEl).catch(e => {
289+
fireOnConsumer('error', { videoElement: videoEl, event: e })
290+
})
283291
},
284292

285293
pause() {
@@ -424,6 +432,10 @@ const videoPlayerPlugin = {
424432
get _videoEl() {
425433
return videoEl
426434
},
435+
436+
get _consumer() {
437+
return consumer
438+
},
427439
}
428440

429441
export default autoSetupMixin(videoPlayerPlugin, () => {

0 commit comments

Comments
 (0)