@lls/lls-audio 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/player/Caption.js +133 -0
- package/player/CustomWave.js +2 -2
- package/player/index.js +9 -2
- package/stories/index.js +2 -0
- package/stories/player.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lls/lls-audio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@kadira/storybook": "^2.21.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"react-dom": "15.3.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@lls/lls-icons": "1.0.
|
|
22
|
+
"@lls/lls-icons": "1.0.39",
|
|
23
23
|
"@lls/lls-ui": "0.1.19",
|
|
24
24
|
"aphrodite": "^1.1.0",
|
|
25
25
|
"is_js": "^0.9.0",
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
|
|
11
|
+
var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
|
|
13
|
+
var _noImportant = require('aphrodite/no-important');
|
|
14
|
+
|
|
15
|
+
var _colors = require('./styles/colors');
|
|
16
|
+
|
|
17
|
+
var _llsIcons = require('@lls/lls-icons');
|
|
18
|
+
|
|
19
|
+
var _llsIcons2 = _interopRequireDefault(_llsIcons);
|
|
20
|
+
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
|
|
23
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
24
|
+
|
|
25
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
26
|
+
|
|
27
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
28
|
+
|
|
29
|
+
//Components
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var styles = _noImportant.StyleSheet.create({
|
|
33
|
+
captionWrapper: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
bottom: 5,
|
|
36
|
+
left: 5
|
|
37
|
+
},
|
|
38
|
+
caption: {
|
|
39
|
+
boxShadow: '0 0 7px rgba(0, 0, 0, 0.32)',
|
|
40
|
+
padding: 10,
|
|
41
|
+
backgroundColor: '#FFF',
|
|
42
|
+
position: 'relative',
|
|
43
|
+
bottom: 16,
|
|
44
|
+
right: 16
|
|
45
|
+
},
|
|
46
|
+
triangle: {
|
|
47
|
+
width: 13,
|
|
48
|
+
height: 10,
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: 21,
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
boxShadow: '0 16px 10px -17px rgba(0, 0, 0, 0.5)',
|
|
53
|
+
':after': {
|
|
54
|
+
content: '""',
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
width: 10,
|
|
57
|
+
height: 10,
|
|
58
|
+
background: '#FFF',
|
|
59
|
+
transform: 'rotate(45deg)',
|
|
60
|
+
top: -5,
|
|
61
|
+
left: 1,
|
|
62
|
+
boxShadow: '0 0 7px rgba(0, 0, 0, 0.32)'
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
var Caption = function (_Component) {
|
|
68
|
+
_inherits(Caption, _Component);
|
|
69
|
+
|
|
70
|
+
function Caption(props) {
|
|
71
|
+
_classCallCheck(this, Caption);
|
|
72
|
+
|
|
73
|
+
var _this = _possibleConstructorReturn(this, (Caption.__proto__ || Object.getPrototypeOf(Caption)).call(this, props));
|
|
74
|
+
|
|
75
|
+
_this.state = { displayCaption: false };
|
|
76
|
+
return _this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_createClass(Caption, [{
|
|
80
|
+
key: 'render',
|
|
81
|
+
value: function render() {
|
|
82
|
+
var _this2 = this;
|
|
83
|
+
|
|
84
|
+
var caption = this.props.caption;
|
|
85
|
+
var displayCaption = this.state.displayCaption;
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
return _react2.default.createElement(
|
|
89
|
+
'figcaption',
|
|
90
|
+
{
|
|
91
|
+
className: 'Caption_wrapper ' + (0, _noImportant.css)(styles.captionWrapper),
|
|
92
|
+
onClick: function onClick() {
|
|
93
|
+
return _this2.toggleCaption();
|
|
94
|
+
},
|
|
95
|
+
onMouseEnter: function onMouseEnter() {
|
|
96
|
+
return _this2.showCaption();
|
|
97
|
+
},
|
|
98
|
+
onMouseLeave: function onMouseLeave() {
|
|
99
|
+
return _this2.hideCaption();
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
displayCaption ? _react2.default.createElement(
|
|
103
|
+
'div',
|
|
104
|
+
{ className: 'Display_on_hover' },
|
|
105
|
+
_react2.default.createElement('div', { className: 'Caption ' + (0, _noImportant.css)(styles.caption), dangerouslySetInnerHTML: { __html: caption } }),
|
|
106
|
+
_react2.default.createElement('div', { className: 'Triangle ' + (0, _noImportant.css)(styles.triangle) })
|
|
107
|
+
) : null,
|
|
108
|
+
_react2.default.createElement(_llsIcons2.default, { name: 'caption', className: 'Caption_icon' })
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: 'toggleCaption',
|
|
113
|
+
value: function toggleCaption() {
|
|
114
|
+
var displayCaption = this.state.displayCaption;
|
|
115
|
+
|
|
116
|
+
this.setState({ displayCaption: !displayCaption });
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: 'showCaption',
|
|
120
|
+
value: function showCaption() {
|
|
121
|
+
this.setState({ displayCaption: true });
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: 'hideCaption',
|
|
125
|
+
value: function hideCaption() {
|
|
126
|
+
this.setState({ displayCaption: false });
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
|
|
130
|
+
return Caption;
|
|
131
|
+
}(_react.Component);
|
|
132
|
+
|
|
133
|
+
exports.default = Caption;
|
package/player/CustomWave.js
CHANGED
|
@@ -94,8 +94,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
94
94
|
currentTime = props.currentTime;
|
|
95
95
|
var pixels_per_second = waveform.pixels_per_second;
|
|
96
96
|
|
|
97
|
-
var maxWidth = _this2.refs.canvas.
|
|
98
|
-
var maxHeight = _this2.refs.canvas.
|
|
97
|
+
var maxWidth = _this2.refs.canvas.clientWidth;
|
|
98
|
+
var maxHeight = _this2.refs.canvas.clientHeight;
|
|
99
99
|
|
|
100
100
|
// Duration and step calculation
|
|
101
101
|
var maxDuration = totalTime || waveform.duration;
|
package/player/index.js
CHANGED
|
@@ -76,6 +76,10 @@ var _Range = require('./Range');
|
|
|
76
76
|
|
|
77
77
|
var _Range2 = _interopRequireDefault(_Range);
|
|
78
78
|
|
|
79
|
+
var _Caption = require('./Caption');
|
|
80
|
+
|
|
81
|
+
var _Caption2 = _interopRequireDefault(_Caption);
|
|
82
|
+
|
|
79
83
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
80
84
|
|
|
81
85
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -192,7 +196,9 @@ var Player = function (_Component) {
|
|
|
192
196
|
_props$onClickDeleteR = _props.onClickDeleteRange,
|
|
193
197
|
onClickDeleteRange = _props$onClickDeleteR === undefined ? false : _props$onClickDeleteR,
|
|
194
198
|
_props$preload = _props.preload,
|
|
195
|
-
preload = _props$preload === undefined ? 'auto' : _props$preload
|
|
199
|
+
preload = _props$preload === undefined ? 'auto' : _props$preload,
|
|
200
|
+
_props$caption = _props.caption,
|
|
201
|
+
caption = _props$caption === undefined ? '' : _props$caption;
|
|
196
202
|
var _state = this.state,
|
|
197
203
|
loading = _state.loading,
|
|
198
204
|
duration = _state.duration,
|
|
@@ -273,7 +279,8 @@ var Player = function (_Component) {
|
|
|
273
279
|
_react2.default.createElement(VolumeRange, { audioRef: this.refs.audio, volume: volume, volumeClassNames: _volumeClassNames2.default }),
|
|
274
280
|
_react2.default.createElement(_llsIcons2.default, { className: 'Close ' + (0, _noImportant.css)(styles.close), onClick: function onClick() {
|
|
275
281
|
return onClose();
|
|
276
|
-
}, name: 'fermer' })
|
|
282
|
+
}, name: 'fermer' }),
|
|
283
|
+
caption ? _react2.default.createElement(_Caption2.default, { caption: caption }) : null
|
|
277
284
|
);
|
|
278
285
|
}
|
|
279
286
|
}]);
|
package/stories/index.js
CHANGED
|
@@ -26,6 +26,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
26
26
|
return _react2.default.createElement(_playerRange2.default, null);
|
|
27
27
|
}).add('Autoplay', function () {
|
|
28
28
|
return _react2.default.createElement(_player2.default, { autoPlay: true });
|
|
29
|
+
}).add('Caption', function () {
|
|
30
|
+
return _react2.default.createElement(_player2.default, { caption: 'Je suis une caption :)' });
|
|
29
31
|
});
|
|
30
32
|
//import PlayerCustom from './playerCustom'
|
|
31
33
|
|
package/stories/player.js
CHANGED
|
@@ -43,7 +43,8 @@ var PlayerExample = function (_Component) {
|
|
|
43
43
|
|
|
44
44
|
var _props = this.props,
|
|
45
45
|
ranges = _props.ranges,
|
|
46
|
-
autoPlay = _props.autoPlay
|
|
46
|
+
autoPlay = _props.autoPlay,
|
|
47
|
+
caption = _props.caption;
|
|
47
48
|
|
|
48
49
|
return _react2.default.createElement(
|
|
49
50
|
'div',
|
|
@@ -66,7 +67,7 @@ var PlayerExample = function (_Component) {
|
|
|
66
67
|
'http://lls-media-public.s3.amazonaws.com/upload/LeLivreScolaire/p15vcjbl4lvpl9l7g8ov8ammh1.mp3'
|
|
67
68
|
)
|
|
68
69
|
),
|
|
69
|
-
_react2.default.createElement(_player2.default, { autoPlay: autoPlay, src: this.state.url, ranges: ranges, visible: true })
|
|
70
|
+
_react2.default.createElement(_player2.default, { autoPlay: autoPlay, src: this.state.url, ranges: ranges, visible: true, caption: caption })
|
|
70
71
|
);
|
|
71
72
|
}
|
|
72
73
|
}]);
|