This commit is contained in:
Richard Davey 2021-09-20 12:16:39 +01:00
commit 36b91a2546
2 changed files with 8 additions and 3 deletions

View file

@ -811,10 +811,11 @@ var Video = new Class({
* @param {string} url - The URL of the video to load or be streamed.
* @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`.
* @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it.
* @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the video load request. Either undefined, `anonymous` or `use-credentials`
*
* @return {this} This Video Game Object for method chaining.
*/
loadURL: function (url, loadEvent, noAudio)
loadURL: function (url, loadEvent, noAudio, crossOrigin)
{
if (loadEvent === undefined) { loadEvent = 'loadeddata'; }
if (noAudio === undefined) { noAudio = false; }
@ -844,6 +845,10 @@ var Video = new Class({
video.setAttribute('playsinline', 'playsinline');
video.setAttribute('preload', 'auto');
if(crossOrigin !== undefined) {
video.setAttribute('crossorigin', crossOrigin);
}
video.addEventListener('error', this._callbacks.error, true);
video.src = url;

View file

@ -802,11 +802,11 @@ var Tilemap = new Class({
sprite.displayHeight = obj.height;
}
// Origin is (0, 1) in Tiled, so find the offset that matches the Sprites origin.
// Origin is (0, 1) for tile objects or (0, 0) for other objects in Tiled, so find the offset that matches the Sprites origin.
// Do not offset objects with zero dimensions (e.g. points).
var offset = {
x: sprite.originX * obj.width,
y: (sprite.originY - 1) * obj.height
y: (sprite.originY - (obj.gid ? 1 : 0)) * obj.height
};
// If the object is rotated, then the origin offset also needs to be rotated.