Integration Guide

Simple steps to embed the JavaScript display library to show Content Credentials on your site

👋

Usage

For a limited time, Truepic is offering our library script to anyone, free of use, without needing account registration.

Human or AI-generated, original or edited—details matter. Our Content Credentials display library helps users understand the media they’re viewing in their browser by visualizing signed provenance data. It reveals the origin and history of any C2PA-compatible digital file.

Below is a guide that walks you through the simple steps to embed the library and signed media on your website.

Signed Media

The Content Credentials pin and metadata information in the overlay can only show up on valid, signed files.

If you have signed media already, that’s great! If not, consider our C2PA signing toolkit. You can also generate signed media with Adobe Photoshop by enabling Content Credentials (beta) on your work. Truepic Display does not show any information about images and audio/video recordings that do not contain C2PA metadata.

The next step is to ensure that your asset hosting and delivery solution does not modify your assets upon upload. Unfortunately, many systems are known to strip metadata like EXIF and C2PA-compliant metadata during processing. If known signed media does not display any credentials in the overlay, something upstream likely stripped it from your file after you uploaded it. See our guides for integrating the library into Shopify and WordPress content management systems.

Library Integration

☑️

Notice

By using this library, you agree to Truepic's terms and conditions.

Simply add this script anywhere on the page, which could be the head or the body. The script will automatically update as we improve our tool, without any code changes required on your part.

<script type="module" src="https://display.truepic.com/truepic_display.es.js"></script>

The final step is to wrap each element that displays signed files in a truepic-display custom element.

<truepic-display>
  <img src="..." />
</truepic-display>

Example

Video

If you are embedding mp4s, note that browser-native video players do not persist overlaid elements in fullscreen mode, so the icon and overlay will not appear there. Only the native <video> element is supported at this time, but we plan to support commercial and open source players to validate streaming media in the future.

<truepic-display>
  <video src="..." controls playsinline />
</truepic-display>

By default, MP4 validation is a two-step process: an initial check on a small (under 600KB) video chunk to quickly flag issues in the manifest store, followed by an option for the user to download and validate the entire file, ensuring the complete hash of the video validated, but without causing unnecessary large downloads that the user didn't opt into. Due to limitations with frontend browser API, mp4 videos can't be monitored with JavaScript to see if they have been downloaded already to automatically validate them. As a workaround, when the video element itself is set to autoplay, the display script will automatically download and validate the video (if the browser is also playing back the video, it will be served from cache rather than downloaded twice).

The truepic-display element also has a configuration option to either prevent or always automatically validate the video.

<truepic-display>
  <video src="..." controls playsinline autoplay />
</truepic-display>
<truepic-display autovalidate="true"> <!-- can also  be FALSE or undefined -->
  <video src="..." controls playsinline />
</truepic-display>

Example

Audio

Audio in m4a format is also supported using the native <audio> element. Due to its shape and size, the icon is positioned to the right of the player to avoid covering the controls.

<truepic-display>
  <audio src="..." controls />
</truepic-display>

Attributes

AttributeDescriptionDefault
activeOpens the overlay on load. Without this attribute, the overlay shows when the icon is clicked.
themeDark mode is enabled in the overlay by default and doesn’t need to be defined, but may be with theme="dark". To enable light mode, set this attribute to light.dark
heightDefines the overlay’s overflow. Defaults to full, allowing the overlay to exceed the height of the media item, while it inherits the media height and scrolls when set to contain.full
autovalidate(audio and video only) Whether to download and validate the video automatically, without the user opting in.

- true - always download and validate the video automatically.
- false - never download and validate the video automatically.
(undefined) - use Truepic's display rules, for example videos set to autoplay will automatically validate

Troubleshooting

If the icon is not appearing on your media, check:

  • The script tag appears correctly on the page
  • Image, video, and audio tags are wrapped with the truepic-display custom element
  • That the media file still has the provenance data preserved. You can use the CAI Verify tool to do this on a hosted asset quickly. Append the absolute path of your media file to this url:
    https://contentcredentials.org/verify?source=
    Visit your constructed url in your browser. If C2PA data is no longer present, the tool will display an error on the right panel, “No Content Credentials attached. There are no Content Credentials attached to this file.” If that’s the case, check your asset hosting and delivery solution to ensure that the media files are not getting modified after they are uploaded. If the Verify tool displays the C2PA information correctly, please get in touch with us using the link at the end of this document for additional support.

Next Steps

Now that you have Content Credentials display live online with signed media, congratulations! You’ve joined the flourishing movement for content transparency. Transparency is our most powerful tool in the quest for greater authenticity online. It protects brands and creators, reduces business and security risks, informs consumers, and generally makes the internet a more authentic place for everyone.

Please contact us if you have any questions or comments about our library.