Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/shaders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ require('./standard');
require('./phong');
require('./sdf');
require('./msdf');
require('./ios10hls');
require('./shadow');
32 changes: 0 additions & 32 deletions src/shaders/ios10hls.js

This file was deleted.

13 changes: 0 additions & 13 deletions src/systems/material.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var registerSystem = require('../core/system').registerSystem;
var THREE = require('../lib/three');
var utils = require('../utils/');
var isHLS = require('../utils/material').isHLS;
var setTextureProperties = require('../utils/material').setTextureProperties;

var bind = utils.bind;
Expand Down Expand Up @@ -156,18 +155,6 @@ module.exports.System = registerSystem('material', {
texture.minFilter = THREE.LinearFilter;
setTextureProperties(texture, data);

// If iOS and video is HLS, do some hacks.
if (this.sceneEl.isIOS &&
isHLS(videoEl.src || videoEl.getAttribute('src'),
videoEl.type || videoEl.getAttribute('type'))) {
// Actually BGRA. Tell shader to correct later.
texture.format = THREE.RGBAFormat;
texture.needsCorrectionBGRA = true;
// Apparently needed for HLS. Tell shader to correct later.
texture.flipY = false;
texture.needsCorrectionFlipY = true;
}

// Cache as promise to be consistent with image texture caching.
videoTextureResult = {texture: texture, videoEl: videoEl};
textureCache[hash] = Promise.resolve(videoTextureResult);
Expand Down
23 changes: 0 additions & 23 deletions src/utils/material.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var THREE = require('../lib/three');

var HLS_MIMETYPES = ['application/x-mpegurl', 'application/vnd.apple.mpegurl'];

var COLOR_MAPS = new Set([
'emissiveMap',
'envMap',
Expand Down Expand Up @@ -183,15 +181,6 @@ function handleTextureEvents (el, texture) {
if (!texture.image || texture.image.tagName !== 'VIDEO') { return; }

texture.image.addEventListener('loadeddata', function emitVideoTextureLoadedDataAll () {
// Check to see if we need to use iOS 10 HLS shader.
// Only override the shader if it is stock shader that we know doesn't correct.
if (!el.components || !el.components.material) { return; }

if (texture.needsCorrectionBGRA && texture.needsCorrectionFlipY &&
['standard', 'flat'].indexOf(el.components.material.data.shader) !== -1) {
el.setAttribute('material', 'shader', 'ios10hls');
}

el.emit('materialvideoloadeddata', {src: texture.image, texture: texture});
});
texture.image.addEventListener('ended', function emitVideoTextureEndedAll () {
Expand All @@ -200,15 +189,3 @@ function handleTextureEvents (el, texture) {
});
}
module.exports.handleTextureEvents = handleTextureEvents;

/**
* Given video element src and type, guess whether stream is HLS.
*
* @param {string} src - src from video element (generally URL to content).
* @param {string} type - type from video element (generally MIME type if present).
*/
module.exports.isHLS = function (src, type) {
if (type && HLS_MIMETYPES.includes(type.toLowerCase())) { return true; }
if (src && src.toLowerCase().indexOf('.m3u8') > 0) { return true; }
return false;
};
32 changes: 0 additions & 32 deletions tests/shaders/ios10hls.test.js

This file was deleted.

35 changes: 0 additions & 35 deletions tests/systems/material.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,41 +211,6 @@ suite('material system', function () {
});
});

test('sets texture flags appropriately when given a <video> element that isHLS on iOS', function (done) {
var videoEl = document.createElement('video');
var system = this.system;
var data = {src: VIDEO1};

// Mock iOS.
var sceneEl = this.el.sceneEl;
var realIsIOS = sceneEl.isIOS;
sceneEl.isIOS = true;
assert.equal(sceneEl.isIOS, true);

// Set up and verify video element to be treated as HLS.
videoEl.setAttribute('src', VIDEO1);
videoEl.setAttribute('type', 'application/x-mpegurl');
assert.equal(AFRAME.utils.material.isHLS(videoEl.getAttribute('src'), videoEl.getAttribute('type')), true);

system.loadVideo(videoEl, data, function (texture) {
assert.equal(texture.image, videoEl);

// Verify system thought this was iOS HLS.
assert.equal(sceneEl.isIOS, true);
assert.equal(AFRAME.utils.material.isHLS(videoEl.getAttribute('src'), videoEl.getAttribute('type')), true);

// Undo mock of iOS.
sceneEl.isIOS = realIsIOS;

// Verify iOS HLS flags from systems/material.js have been applied.
assert.equal(texture.format, THREE.RGBAFormat);
assert.equal(texture.needsCorrectionBGRA, true);
assert.equal(texture.flipY, false);
assert.equal(texture.needsCorrectionFlipY, true);
done();
});
});

test('caches identical video textures', function (done) {
var system = this.system;
var src = VIDEO1;
Expand Down
39 changes: 0 additions & 39 deletions tests/utils/isHLS.test.js

This file was deleted.