Skip to content

Commit

Permalink
Merge pull request #95 from AdobeDocs/audio-updates-anim-stable
Browse files Browse the repository at this point in the history
Updates to addAudio() API and removes experimental warnings for getting animated images method
  • Loading branch information
hollyschinsky authored Oct 8, 2024
2 parents 02fe7e7 + cfa0151 commit 2b22052
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
8 changes: 2 additions & 6 deletions src/pages/guides/develop/use_cases/content_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ async function addImageFromURL(url) {

There's a specific method provided in the `AddOnSDK` to allow you to add animated images (gifs) to the current page as well.

<InlineAlert slots="text" variant="warning"/>

**IMPORTANT:** The [`addAnimatedImage()`](../../../references/addonsdk/app-document.md#addanimatedimage) method is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use this method, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../references/manifest/index.md#requirements) section of the `manifest.json`.

#### Add Animated Image Example

```js
Expand Down Expand Up @@ -92,7 +88,7 @@ You can also import video and audio content similarly via the [`addVideo()`](htt
```js
async function addAudioFromBlob(blob) {
try {
await document.addAudio(blob, {title: "Jazzy beats"});
await document.addAudio(blob, {title: "Jazzy beats", author: "Jazzy"});
}
catch(error) {
console.log("Failed to add the audio to the page.");
Expand All @@ -102,7 +98,7 @@ async function addAudioFromBlob(blob) {
async function addAudioFromURL(url) {
try {
const blob = await fetch(url).then(response => response.blob());
await document.addAudio(blob, {title: "Jazzy beats"});
await document.addAudio(blob, {title: "Jazzy beats", author: "Jazzy"});
}
catch(error) {
console.log("Failed to add the audio to the page.");
Expand Down
4 changes: 0 additions & 4 deletions src/pages/guides/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ Once you find config file, delete the two properties defined for `sslCertPath` a
- **Maximum GIFs per scene:** 7

**Importing gifs:** You should use the [`addAnimatedImage()`](../references/addonsdk/app-document.md#addanimatedimage) method when you want to import an animated GIF by default. It will be added as an animated GIF to the document as long as it fits [the size criteria for animated GIF's](https://helpx.adobe.com/express/create-and-edit-videos/change-file-formats/import-gif-limits.html). In the event that it does not fit the criteria, only the first frame will be added. **Note:** Though [`addImage()`](../references/addonsdk/app-document.md#addaudio) supports the `gif` file type, if an animated GIF is passed in, only the first frame will be added.

<InlineAlert slots="text" variant="warning"/>

**IMPORTANT:** The [`addAnimatedImage()`](../references/addonsdk/app-document.md#addanimatedimage) method is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use this method, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../references/manifest/index.md#requirements) section of the `manifest.json`.

**Drag and drop:** If the content being dragged is an animated GIF, it will be added as an animated GIF to the document, as long as it fits [the size criteria for animated GIF's](https://helpx.adobe.com/express/create-and-edit-videos/change-file-formats/import-gif-limits.html). In the event that it doesn't fit the size criteria, an error toast will be shown to the user.

Expand Down
13 changes: 5 additions & 8 deletions src/pages/references/addonsdk/app-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ Refer to the [image requirements](#image-requirements) section for specific deta

Adds an animated image (gif) to the current page.

<InlineAlert slots="text" variant="warning"/>

**IMPORTANT:** The [`addAnimatedImage()`](../addonsdk/app-document.md#addanimatedimage) method is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use this method, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../references/manifest/index.md#requirements) section of the `manifest.json`.

#### Signature

`addAnimatedImage(imageBlob: Blob, attributes?: MediaAttributes): Promise<void>`
Expand Down Expand Up @@ -300,8 +296,8 @@ A resolved promise if the audio was successfully added to the canvas; otherwise

```js
async function addAudioFromBlob(blob) {
try {
await document.addAudio(blob, {title: "Jazzy beats"});
try {
await document.addAudio(blob, {title: "Jazzy beats", author: "Jazzy"});
}
catch(error) {
console.log("Failed to add the audio to the page.");
Expand All @@ -310,8 +306,8 @@ async function addAudioFromBlob(blob) {

async function addAudioFromURL(url) {
try {
const blob = await fetch(url).then(response => response.blob());
await document.addAudio(blob, {title: "Jazzy beats"});
const blob = await fetch(url).then(response => response.blob());
await document.addAudio(blob, {title: "Jazzy beats", author: "Jazzy"});
}
catch(error) {
console.log("Failed to add the audio to the page.");
Expand All @@ -323,6 +319,7 @@ async function addAudioFromURL(url) {
| Name | Type | Description |
| ------------- | -------------| ----------------------------------------: |
| `title` | `string` | Media title (mandatory for audio import). |
| `author?` | `string` | Media author |
<InlineAlert slots="text" variant="info"/>
Expand Down
7 changes: 6 additions & 1 deletion src/pages/references/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ contributors:

# Changelog

## 2024-10-08

- Removes the experimental warnings for [`addAnimatedImage()`](./addonsdk/app-document.md#addanimatedimage) since it is now stable.
- Adds the `author` property to [`MediaAttributes`](../references/addonsdk/app-document.md#mediaattributes) to allow it to be used with the [`addAudio()`](../references/addonsdk/app-document.md#addaudio) API.

## 2024-09-30

### New
Expand Down Expand Up @@ -59,7 +64,7 @@ contributors:

<InlineAlert slots="text" variant="warning"/>

**IMPORTANT:** The [`addAnimatedImage()`](./addonsdk/app-document.md#addanimatedimage), [`importPdf()`](./addonsdk/app-document.md#importpdf) and [`importPresentation()`](./addonsdk/app-document.md#importpresentation) methods are currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use this method, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../references/manifest/index.md#requirements) section of the `manifest.json`.
**IMPORTANT:** The [`importPdf()`](./addonsdk/app-document.md#importpdf) and [`importPresentation()`](./addonsdk/app-document.md#importpresentation) methods are currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use this method, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../references/manifest/index.md#requirements) section of the `manifest.json`.

## 2024-09-10

Expand Down

0 comments on commit 2b22052

Please sign in to comment.