Skip to content

Commit

Permalink
docs: Add uploader events
Browse files Browse the repository at this point in the history
  • Loading branch information
shantanutomarr committed Nov 7, 2024
1 parent 76a2594 commit 7166d4e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion docs/embedded-uploader/embedded-uploader.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,27 @@ The following code will display the TPStreams uploader UI on your webpage, allow
### Domain Restrictions for Embedding
In TPStreams settings, you can restrict the allowed domains that can embed this uploader. Set the allowed domain(s) to ensure only specified sites can use your uploader. If no domain is specified, all domains are permitted by default.

![Domain Restriction](./img/uploader_allowed_domains.png)
![Domain Restriction](./img/uploader_allowed_domains.png)


## Uploader Events
You can listen for events in the uploader by attaching a callback using .on()

### fileUploaded
This event fires when a video is successfully uploaded to TpStreams.


```html
<script>
const uploader = document.querySelector('tpstreams-uploader');
uploader.authToken = '33ee07f2a51be363cc94daa460faf46b7d5ea29463aaad28ba948aa042bf871f';
uploader.initialize();
uploader.on('fileUploaded', (file) => {
const fileName = file.name;
const assetId = file.assetId;
console.log("Filename", fileName)
console.log("Asset ID", assetId)
});
</script>
```

0 comments on commit 7166d4e

Please sign in to comment.