@@ -30,6 +30,12 @@ Assets expose properties that can be referenced in operations. The properties cu | |||||
* `duration`: duration of the audio/video in seconds (audio and video assets only) | * `duration`: duration of the audio/video in seconds (audio and video assets only) | ||||
* `width`: width of the video in pixels (video and image assets only) | * `width`: width of the video in pixels (video and image assets only) | ||||
* `height`: width of the video in pixels (video and image assets only) | * `height`: width of the video in pixels (video and image assets only) | ||||
* `aspectRatio`: ratio of width / height (video and image assets only) | |||||
* `samplingRate`: sampling rate in Hz (audio assets only) | |||||
* `tracks`: array of tracks. only includes audio and video tracks (video only) | |||||
* `audioTracks`: array of audio tracks (video only) | |||||
* `videoTracks`: array of video tracks (video only) | |||||
* `assets`: for a list asset, these are the nested sub-assets | |||||
## Operations | ## Operations | ||||
Operations represent transformations to perform on the inputs, and validations | Operations represent transformations to perform on the inputs, and validations | ||||
@@ -61,6 +61,12 @@ Resolution width in pixes (video or image). | |||||
#### `height` | #### `height` | ||||
Resolution height in pixes (video or image). | Resolution height in pixes (video or image). | ||||
#### `aspectRatio` | |||||
Ratio of width / height (video or image). | |||||
#### `samplingRate` | |||||
Sampling rate in Hz (audio). | |||||
#### `tracks` | #### `tracks` | ||||
An array of the tracks in a video. Only includes audio and video tracks. | An array of the tracks in a video. Only includes audio and video tracks. | ||||
@@ -16,6 +16,8 @@ public class JAssetJs { | |||||
public Double duration; | public Double duration; | ||||
public Integer width; | public Integer width; | ||||
public Integer height; | public Integer height; | ||||
public Double aspectRatio; | |||||
public Integer samplingRate; | |||||
public JTrackJs[] tracks = EMPTY_TRACKS; | public JTrackJs[] tracks = EMPTY_TRACKS; | ||||
public JTrackJs[] videoTracks = EMPTY_TRACKS; | public JTrackJs[] videoTracks = EMPTY_TRACKS; | ||||
public JTrackJs[] audioTracks = EMPTY_TRACKS; | public JTrackJs[] audioTracks = EMPTY_TRACKS; | ||||
@@ -31,6 +33,9 @@ public class JAssetJs { | |||||
final BigDecimal h = asset.height(); | final BigDecimal h = asset.height(); | ||||
this.height = h == null ? null : h.intValue(); | this.height = h == null ? null : h.intValue(); | ||||
this.aspectRatio = asset.aspectRatio() == null ? Double.NaN : asset.aspectRatio().doubleValue(); | |||||
this.samplingRate = asset.hasSamplingRate() ? asset.samplingRate().intValue() : 0; | |||||
if (asset.hasInfo()) { | if (asset.hasInfo()) { | ||||
final JMediaInfo info = asset.getInfo(); | final JMediaInfo info = asset.getInfo(); | ||||
for (JTrack track : info.getMedia().getTrack()) { | for (JTrack track : info.getMedia().getTrack()) { | ||||