Skip to content

Instantly share code, notes, and snippets.

@cubesky

cubesky/Bilibili-360VR.js

Last active Apr 24, 2020
Embed
What would you like to do?
Use babylonJS to Render Bilibili 360 Video to VR HeadSet
var cav = document.createElement('canvas')
cav.style.width = "100%"
cav.style.height = "100%"
document.querySelector('#v_tag').append(cav)
var babylon = document.createElement('script')
babylon.src = "https://cdn.babylonjs.com/babylon.js"
babylon.onload = function() {
var engine = new BABYLON.Engine(cav,true)
var createScene = function () {
var scene = new BABYLON.Scene(engine);
var vrHelper = scene.createDefaultVRExperience();
vrHelper.teleportationEnabled = false;
var videoDome = new BABYLON.VideoDome(
"videoDome",
[player.getPlayurl()],
{
resolution: 32
},
scene
);
vrHelper.currentVRCamera.attachControl(cav, true);
return scene;
};
var scene = createScene()
engine.runRenderLoop(function() {
scene.render();
});
window.addEventListener('resize', function() {
engine.resize();
});
}
document.body.appendChild(babylon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.