ostbay-player 1.0.0
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/README.md +131 -0
- package/dist/index.css +1 -0
- package/dist/ostbay-player.cjs.js +30 -0
- package/dist/ostbay-player.es.js +1035 -0
- package/dist/types/components/OstbayIcon/Icons/Logo.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/Next.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/Ostbay.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/Pause.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/Play.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/PlayList.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/Prev.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/RepeatAll.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/RepeatNone.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/RepeatOne.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/RepeatShuffle.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/VolumeFull.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/VolumeMiddle.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/VolumeNone.d.ts +1 -0
- package/dist/types/components/OstbayIcon/Icons/index.d.ts +14 -0
- package/dist/types/components/OstbayIcon/OstbayIcon.d.ts +2 -0
- package/dist/types/components/OstbayIcon/OstbayIcon.types.d.ts +7 -0
- package/dist/types/components/OstbayIcon/index.d.ts +2 -0
- package/dist/types/components/OstbayPlayer/OstbayPlayer.d.ts +2 -0
- package/dist/types/components/OstbayPlayer/OstbayPlayer.types.d.ts +13 -0
- package/dist/types/components/OstbayPlayer/constants.d.ts +5 -0
- package/dist/types/components/OstbayPlayer/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Ostbay Player
|
|
2
|
+
|
|
3
|
+
Аудиоплеер Ostbay. Основан на библиотеке `react-modern-audio-player`.
|
|
4
|
+
|
|
5
|
+
**Важно**: Библиотека не совместима с React 19. Используйте React версии 16.8.0 - 18.3.1.
|
|
6
|
+
|
|
7
|
+
## Связанные ссылки
|
|
8
|
+
|
|
9
|
+
- [Демо](https://ostbay-player.vercel.app/)
|
|
10
|
+
- [Ostbay Platform](https://platform.ostbay.com/)
|
|
11
|
+
- [GitHub Repository](https://github.com/snooperv/ostbay_player)
|
|
12
|
+
|
|
13
|
+
## Особенности
|
|
14
|
+
|
|
15
|
+
- Полнофункциональный аудиоплеер с плейлистом
|
|
16
|
+
- Кастомные иконки Ostbay
|
|
17
|
+
- Адаптивный дизайн
|
|
18
|
+
|
|
19
|
+
## Установка
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install ostbay-player
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Требования
|
|
26
|
+
|
|
27
|
+
- React >= 16.8.0 <= 18.3.1
|
|
28
|
+
- React DOM >= 16.8.0 <= 18.3.1
|
|
29
|
+
- react-modern-audio-player >= 1.0.0 <= 1.3.0
|
|
30
|
+
|
|
31
|
+
## Использование
|
|
32
|
+
|
|
33
|
+
### Базовое использование
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import React, {useRef} from 'react';
|
|
37
|
+
import {OstbayPlayer} from 'ostbay-player';
|
|
38
|
+
|
|
39
|
+
const App = () => {
|
|
40
|
+
const audioRef = useRef<HTMLAudioElement>(null); // ref на контейнер
|
|
41
|
+
const ostbayPlayerRef = useRef<HTMLDivElement>(null); // ref на проигрыватель
|
|
42
|
+
|
|
43
|
+
const playList = [
|
|
44
|
+
{
|
|
45
|
+
name: 'Название аудиофайла',
|
|
46
|
+
src: '/path/to/audio.mp3', // может быть ссылкой
|
|
47
|
+
writer: 'Исполнитель'
|
|
48
|
+
},
|
|
49
|
+
// ... другие аудиофайлы
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<OstbayPlayer
|
|
54
|
+
audioRef={audioRef}
|
|
55
|
+
playList={playList}
|
|
56
|
+
ref={ostbayPlayerRef}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Расширенное использование
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import React, {useRef} from 'react';
|
|
66
|
+
import {OstbayPlayer} from 'ostbay-player';
|
|
67
|
+
|
|
68
|
+
const App = () => {
|
|
69
|
+
const audioRef = useRef<HTMLAudioElement>(null);
|
|
70
|
+
const ostbayPlayerRef = useRef<HTMLDivElement>(null);
|
|
71
|
+
|
|
72
|
+
const playList = [
|
|
73
|
+
{
|
|
74
|
+
id: 1,
|
|
75
|
+
name: 'Название аудиофайла 1',
|
|
76
|
+
src: '/audio/track1.mp3',
|
|
77
|
+
writer: 'Исполнитель 1'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 2,
|
|
81
|
+
name: 'Название аудиофайла 2',
|
|
82
|
+
src: '/audio/track2.mp3',
|
|
83
|
+
writer: 'Исполнитель 2'
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<OstbayPlayer
|
|
89
|
+
audioRef={audioRef}
|
|
90
|
+
className="custom-class"
|
|
91
|
+
playList={playList}
|
|
92
|
+
ref={ostbayPlayerRef}
|
|
93
|
+
style={{
|
|
94
|
+
width: '100%',
|
|
95
|
+
maxWidth: '600px'
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## API
|
|
103
|
+
|
|
104
|
+
### OstbayPlayer Props
|
|
105
|
+
|
|
106
|
+
| Prop | Тип | Обязательный | Описание |
|
|
107
|
+
|-------------|-----|-------------|-------------------------------------------|
|
|
108
|
+
| `playList` | `IPlayListItem[]` | ✅ | Массив аудиофайлов для воспроизведения |
|
|
109
|
+
| `audioRef` | `RefObject<HTMLAudioElement>` | ❌ | Ссылка на HTML audio элемент |
|
|
110
|
+
| `className` | `string` | ❌ | CSS класс для контейнера |
|
|
111
|
+
| `ref` | `RefObject<HTMLDivElement>` | ❌ | Ссылка на HTML div элемент для контейнера |
|
|
112
|
+
| `style` | `CSSProperties` | ❌ | Инлайн стили для контейнера |
|
|
113
|
+
|
|
114
|
+
### IPlayListItem
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
interface IPlayListItem {
|
|
118
|
+
id?: number // Уникальный идентификатор (опционально)
|
|
119
|
+
name: string, // Название трека
|
|
120
|
+
src: string, // Путь к аудиофайлу
|
|
121
|
+
writer: string, // Исполнитель
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Лицензия
|
|
126
|
+
|
|
127
|
+
MIT License
|
|
128
|
+
|
|
129
|
+
## Поддержка
|
|
130
|
+
|
|
131
|
+
Если у вас есть вопросы или предложения, создайте [issue](https://github.com/snooperv/ostbay_player/issues) в репозитории.
|