Skip to content

Commit d3cc9d3

Browse files
committed
fix: handle download for audio players
1 parent 5a1e5d7 commit d3cc9d3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/audio.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<script type="text/javascript">
2727
window.addEventListener('load', function(){
2828

29-
var player = cloudinary.videoPlayer('player', { cloud_name: 'demo' });
29+
var player = cloudinary.videoPlayer('player', { cloud_name: 'demo', download: true });
3030

3131
var source = { publicId: 'dog', 'sourceTypes': ['audio'] };
3232

src/plugins/share/share.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ const SharePlugin = function (options = {}, playerInstance) {
7272
});
7373
}
7474

75+
// For audio sources, set the format to mp3
76+
if (player.cloudinary.source()?.getType() === 'AudioSource') {
77+
Object.assign(baseOptions, {
78+
format: 'mp3',
79+
video_codec: undefined,
80+
});
81+
}
82+
7583
return getCloudinaryUrl(player.cloudinary.currentPublicId(), baseOptions);
7684
};
7785

0 commit comments

Comments
 (0)