-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Revert media duration setting to on loadeddata (#759)
- Loading branch information
Jeremy Press
authored
Apr 5, 2018
1 parent
d34835c
commit df798d1
Showing
6 changed files
with
158 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<style> | ||
.preview-container { | ||
border: 1px solid #eee; | ||
height: 490px; | ||
width: 100%; | ||
} | ||
</style> | ||
<link rel="stylesheet" type="text/css" href="../dist/dev/en-US/preview.css"> | ||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise"></script> | ||
<script src="../dist/dev/en-US/preview.js"></script> | ||
|
||
</head> | ||
|
||
<body> | ||
<div class="preview-container"></div> | ||
<script> | ||
var ACCESS_TOKEN = 'edRiUpeLD9A1nLyWqc1gZOt2OnSNNYp9'; | ||
|
||
var FILE_ID_VIDEO = '286114565199'; | ||
var FILE_ID_MP3 = '286509191779'; | ||
|
||
var preview = new Box.Preview(); | ||
preview.show(FILE_ID_VIDEO, ACCESS_TOKEN, { | ||
container: '.preview-container', | ||
showDownload: false, | ||
collection: [FILE_ID_VIDEO, FILE_ID_MP3], | ||
}); | ||
|
||
function disableDash() { | ||
preview.disableViewers('Dash'); | ||
|
||
preview.show(FILE_ID_VIDEO, ACCESS_TOKEN, { | ||
container: '.preview-container', | ||
showDownload: false, | ||
}); | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const { | ||
SELECTOR_MEDIA_TIMESTAMP, | ||
SELECTOR_MEDIA_DURATION, | ||
SELECTOR_BOX_PREVIEW_LOGO, | ||
CLASS_BOX_PREVIEW_LOADING_WRAPPER, | ||
SELECTOR_BOX_PREVIEW_MP3, | ||
SELECTOR_BOX_PREVIEW_DASH, | ||
SELECTOR_BOX_PREVIEW_MP4 | ||
} = require('./constants'); | ||
|
||
const { navigateToNextItem, makeNavAppear, waitForLoad } = require('./helpers'); | ||
|
||
const { CI } = process.env; | ||
const DEFAULT_START = '0:00'; | ||
const VIDEO_DURATION = '3:52'; | ||
const AUDIO_DURATION = '7:47'; | ||
const SELECTOR_VIDEO = 'video'; | ||
|
||
Feature('Media Controls', { retries: CI ? 3 : 0 }); | ||
|
||
Before((I) => { | ||
I.amOnPage('/functional-tests/media-controls.html'); | ||
I.waitForElement(SELECTOR_BOX_PREVIEW_LOGO); | ||
waitForLoad(I); | ||
I.waitForElement(SELECTOR_BOX_PREVIEW_DASH); | ||
}); | ||
|
||
// Exclude IE as it can't handle media files with saucelabs | ||
Scenario( | ||
'Check that the media controls show the correct time current/total times @ci @chrome @firefox @edge @safari @android @ios', | ||
{ retries: 3 }, | ||
(I) => { | ||
// video (dash) | ||
waitForLoad(I); | ||
I.waitForElement(SELECTOR_BOX_PREVIEW_DASH); | ||
makeNavAppear(I, SELECTOR_VIDEO); | ||
I.waitForVisible(SELECTOR_MEDIA_TIMESTAMP); | ||
I.seeTextEquals(DEFAULT_START, SELECTOR_MEDIA_TIMESTAMP); | ||
I.seeTextEquals(VIDEO_DURATION, SELECTOR_MEDIA_DURATION); | ||
navigateToNextItem(I); | ||
|
||
// mp3 | ||
waitForLoad(I); | ||
I.waitForElement(SELECTOR_BOX_PREVIEW_MP3); | ||
makeNavAppear(I); | ||
I.waitForVisible(SELECTOR_MEDIA_TIMESTAMP); | ||
I.seeTextEquals(DEFAULT_START, SELECTOR_MEDIA_TIMESTAMP); | ||
I.seeTextEquals(AUDIO_DURATION, SELECTOR_MEDIA_DURATION); | ||
|
||
// video (mp4) | ||
/* eslint-disable prefer-arrow-callback */ | ||
I.executeScript(function() { | ||
window.disableDash(); | ||
}); | ||
I.waitForElement(CLASS_BOX_PREVIEW_LOADING_WRAPPER); | ||
/* eslint-enable prefer-arrow-callback */ | ||
waitForLoad(I); | ||
I.waitForElement(SELECTOR_BOX_PREVIEW_MP4); | ||
|
||
makeNavAppear(I, SELECTOR_VIDEO); | ||
I.waitForVisible(SELECTOR_MEDIA_TIMESTAMP); | ||
I.seeTextEquals(DEFAULT_START, SELECTOR_MEDIA_TIMESTAMP); | ||
I.seeTextEquals(VIDEO_DURATION, SELECTOR_MEDIA_DURATION); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters