2020-10-17 19:08:56 +01:00
|
|
|
import ServerConnections from '../../components/ServerConnections';
|
2020-05-19 03:59:37 +09:00
|
|
|
|
2020-05-30 19:51:03 +09:00
|
|
|
export default class PhotoPlayer {
|
2020-05-19 03:59:37 +09:00
|
|
|
constructor() {
|
|
|
|
this.name = 'Photo Player';
|
|
|
|
this.type = 'mediaplayer';
|
|
|
|
this.id = 'photoplayer';
|
|
|
|
this.priority = 1;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-05-19 03:59:37 +09:00
|
|
|
play(options) {
|
2021-01-26 22:20:12 -05:00
|
|
|
return new Promise(function (resolve) {
|
2020-08-16 20:24:45 +02:00
|
|
|
import('../../components/slideshow/slideshow').then(({default: Slideshow}) => {
|
2020-10-19 20:25:58 +01:00
|
|
|
const index = options.startIndex || 0;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-10-19 20:25:58 +01:00
|
|
|
const apiClient = ServerConnections.currentApiClient();
|
2020-05-02 02:54:14 +05:30
|
|
|
apiClient.getCurrentUser().then(function(result) {
|
2020-10-19 20:25:58 +01:00
|
|
|
const newSlideShow = new Slideshow({
|
2020-05-02 02:40:48 +05:30
|
|
|
showTitle: false,
|
|
|
|
cover: false,
|
|
|
|
items: options.items,
|
|
|
|
startIndex: index,
|
|
|
|
interval: 11000,
|
|
|
|
interactive: true,
|
2021-09-09 00:06:09 +03:00
|
|
|
// playbackManager.shuffle has no options. So treat 'shuffle' as a 'play' action
|
|
|
|
autoplay: options.autoplay || options.shuffle,
|
2020-05-02 02:40:48 +05:30
|
|
|
user: result
|
2020-05-02 00:57:51 +05:30
|
|
|
});
|
2020-05-02 02:40:48 +05:30
|
|
|
|
|
|
|
newSlideShow.show();
|
|
|
|
resolve();
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
2020-05-02 02:40:48 +05:30
|
|
|
});
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
2020-05-19 03:59:37 +09:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2020-05-19 03:59:37 +09:00
|
|
|
canPlayMediaType(mediaType) {
|
2019-01-10 15:39:37 +03:00
|
|
|
return (mediaType || '').toLowerCase() === 'photo';
|
2020-05-19 03:59:37 +09:00
|
|
|
}
|
|
|
|
}
|