-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: light esm build #765
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Cloudinary Video Player</title> | ||
<link | ||
href="https://res.cloudinary.com/cloudinary-marketing/image/upload/f_auto,q_auto/c_scale,w_32,e_hue:290/creative_staging/cloudinary_internal/Website/Brand%20Updates/Favicon/cloudinary_web_favicon_192x192.png" | ||
rel="icon" | ||
type="image/png" | ||
/> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
</head> | ||
<body> | ||
<div class="container p-4 col-12 col-md-9 col-xl-6"> | ||
<nav class="nav mb-2"> | ||
<a href="/index.html"><< Back to examples index</a> | ||
</nav> | ||
<h1>Cloudinary Video Player</h1> | ||
<h3 class="mb-4"><code>/all</code> build</h3> | ||
|
||
<p>Using the <code>/all</code> build, you get a build that already includes all plugins (except the big <code>/dash</code> plugin), saving you the need to import them separately</p> | ||
|
||
<video | ||
id="player" | ||
class="cld-video-player cld-fluid" | ||
crossorigin="anonymous" | ||
controls | ||
muted | ||
playsinline | ||
></video> | ||
|
||
<p class="mt-4"> | ||
<a href="https://cloudinary.com/documentation/cloudinary_video_player#installation" | ||
>Full documentation</a | ||
> | ||
</p> | ||
</div> | ||
|
||
<script type="module"> | ||
import { videoPlayer } from 'cloudinary-video-player/all'; | ||
import 'cloudinary-video-player/cld-video-player.min.css'; | ||
|
||
const player = videoPlayer('player', { | ||
cloudName: 'demo', | ||
publicId: 'dog', | ||
autoplay: true, | ||
chapters: { | ||
0: 'Chapter I', | ||
3: 'Chapter II', | ||
8: 'Chapter III', | ||
} | ||
}); | ||
</script> | ||
|
||
<!-- Bootstrap --> | ||
<link | ||
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" | ||
crossorigin="anonymous" | ||
/> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Cloudinary Video Player</title> | ||
<link | ||
href="https://res.cloudinary.com/cloudinary-marketing/image/upload/f_auto,q_auto/c_scale,w_32,e_hue:290/creative_staging/cloudinary_internal/Website/Brand%20Updates/Favicon/cloudinary_web_favicon_192x192.png" | ||
rel="icon" | ||
type="image/png" | ||
/> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
</head> | ||
<body> | ||
<div class="container p-4 col-12 col-md-9 col-xl-6"> | ||
<nav class="nav mb-2"> | ||
<a href="/index.html"><< Back to examples index</a> | ||
</nav> | ||
<h1>Cloudinary Video Player</h1> | ||
<h3 class="mb-4"><code>/light</code> build</h3> | ||
|
||
<p>Using the <code>/light</code> build gives you the smallest possible bundle-size</p> | ||
|
||
<video | ||
id="player" | ||
class="cld-video-player cld-fluid" | ||
crossorigin="anonymous" | ||
controls | ||
muted | ||
playsinline | ||
></video> | ||
|
||
<p class="mt-4"> | ||
<a href="https://cloudinary.com/documentation/cloudinary_video_player#installation" | ||
>Full documentation</a | ||
> | ||
</p> | ||
</div> | ||
|
||
<script type="module"> | ||
import { videoPlayer } from 'cloudinary-video-player/light'; | ||
import 'cloudinary-video-player/light/chapters'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would this work Also this way the imports are not consistent with the css import There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, unfortunately it won't work since both /chapters and /light/chapters are importing videojs, but they were compiled using a different videojs core. |
||
import 'cloudinary-video-player/cld-video-player.min.css'; | ||
|
||
const player = videoPlayer('player', { | ||
cloudName: 'demo', | ||
publicId: 'dog', | ||
autoplay: true, | ||
chapters: { | ||
0: 'Chapter I', | ||
3: 'Chapter II', | ||
8: 'Chapter III', | ||
} | ||
}); | ||
</script> | ||
|
||
<!-- Bootstrap --> | ||
<link | ||
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" | ||
crossorigin="anonymous" | ||
/> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,11 @@ const getCloudinaryOptions = (cloudinaryOptions = {}) => ({ | |
}); | ||
|
||
const getTranscriptOptions = (textTracks = {}) => { | ||
const tracksArr = [textTracks.captions, ...textTracks.subtitles]; | ||
const tracksArr = [textTracks.captions, ...(textTracks.subtitles || [])]; | ||
return { | ||
textTracks: hasConfig(textTracks), | ||
textTracksLength: tracksArr.length, | ||
textTracksOptions: hasConfig(textTracks.options) || Object.keys(textTracks.options).join(','), | ||
textTracksOptions: hasConfig(textTracks.options) && Object.keys(textTracks.options).join(','), | ||
Comment on lines
+23
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how these two changes are related to exporting light version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They don't, just fixed a warning I got while working on this |
||
pacedTextTracks: hasConfig(textTracks) && JSON.stringify(textTracks || {}).includes('"maxWords":') || null, | ||
wordHighlight: hasConfig(textTracks) && JSON.stringify(textTracks || {}).includes('"wordHighlight":') || null, | ||
transcriptLanguages: tracksArr.filter((track) => !track.url).map((track) => track.language || '').join(',') || null, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { merge } = require('webpack-merge'); | ||
const webpackConfig = require('./es6.config'); | ||
const path = require('path'); | ||
|
||
delete webpackConfig.entry; // overwrite | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could be that there is something in webpack-merge api that allows you to overwrite when merging which maybe can be easier to read as it is more explict ? (Just a thought, i did not really go and checked their API) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought |
||
|
||
module.exports = merge(webpackConfig, { | ||
|
||
entry: { | ||
'index': './index.es.js' | ||
}, | ||
|
||
output: { | ||
path: path.resolve(__dirname, '../lib/light'), | ||
} | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not critical but the title should match the example name ....same comment for the second example as well.