Skip to content

Commit

Permalink
fixes #60
Browse files Browse the repository at this point in the history
  • Loading branch information
NinoSkopac committed Apr 2, 2018
1 parent 41fd62f commit 17f9c01
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/app.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/widget.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/widget.min.html

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/js/Read2MeHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ export default class Read2MeHelpers {
return window.outerWidth < 768;
}

static isFirefox() {
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
}

static isSamsungBrowser() {
return navigator.userAgent.indexOf('SamsungBrowser') > -1;
}

// source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
static getRandom4ByteUnsignedInt() {
let min = 0;
Expand Down Expand Up @@ -200,8 +208,4 @@ export default class Read2MeHelpers {
colors: [colors]
});
}

static isFirefox() {
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
}
}
13 changes: 8 additions & 5 deletions src/js/Read2MeWidgetPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ export default class Read2MeWidgetPlayer {
this.handleViewportResize();
this._setListeningSessionId();

if (!Read2MeHelpers.isFirefox())
if (!Read2MeHelpers.isFirefox() && !Read2MeHelpers.isSamsungBrowser())
this.makeVisible();

if (Read2MeHelpers.isSamsungBrowser())
this.phoneUi.querySelector('.read2me-phone-playback').style['justify-content'] = 'space-around';
}

finishInitialisation(audioController, backendWrapper, apiResponse) {
Expand All @@ -76,7 +79,7 @@ export default class Read2MeWidgetPlayer {
if (backendWrapper instanceof Read2MeBackendWrapper === false)
throw new Error('Invalid second argument for Read2MeWidgetPlayer.finishInitialisation(); must be an instance of Read2MeBackendWrapper');

if (Read2MeHelpers.isFirefox())
if (Read2MeHelpers.isFirefox() || Read2MeHelpers.isSamsungBrowser())
this.makeVisible();

this.audioController = audioController;
Expand Down Expand Up @@ -245,7 +248,7 @@ export default class Read2MeWidgetPlayer {

handlePlayback() {
[this.playbackContainer, this.phonePlaybackContainer].forEach( (elem, index) => {
['click', 'touchstart'].forEach(eventType => {
['click', 'touchend'].forEach(eventType => {
// dont bind click on phone container
if (index === 1 && eventType === 'click')
return;
Expand Down Expand Up @@ -299,7 +302,7 @@ export default class Read2MeWidgetPlayer {
this.audioController.forwardForXSeconds(10);
});

['click', 'touchstart'].forEach(eventType => {
['click', 'touchend'].forEach(eventType => {
tabletDesktopRewind.addEventListener(eventType, () => {
if (!this._isPlaybackEventPermitted(250))
return;
Expand Down Expand Up @@ -372,7 +375,7 @@ export default class Read2MeWidgetPlayer {
callback(phoneSpeakingRate);
});

['click', 'touchstart'].forEach(eventType => {
['click', 'touchend'].forEach(eventType => {
tabletDesktopSpeakingRate.addEventListener(eventType, () => {
if (!this._isPlaybackEventPermitted(250))
return;
Expand Down

0 comments on commit 17f9c01

Please sign in to comment.