Videosphere, video freeze when going to VR if it was playing in "mono" mode.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 4.4k
- PR merge metrics
- No merged PRs in 30d
Description
When using the videosphere, if you begin to play the video in mono mode, then go into VR. The video will freeze, not just "stop" or "pause", calling ".play()" does nothing. Also doing the same thing on a Nexus 5 (no X) I think (don't have the exact phone with me) AND was crashing, that phone would actually go full black and reboot.
Not playing the video beforehand and going straight to VR and then play the video, no problem.
Here's a cheap work around to get around this.
$( document ).ready( function()
{
var scene = document.querySelector("a-scene");
var video = document.getElementById("video");
if (scene.hasLoaded) {
run();
} else {
scene.addEventListener('loaded', run);
}
function run () {
scene.addEventListener('enter-vr', enterVR);
scene.addEventListener('exit-vr', exitVR);
}
function enterVR() {
video.load();
}
function exitVR() {
}
});
So basically, call ".load()" on the video element on 'enter-vr' event.
To set current time back to where it was I have to actually wait for 3 "timeupdate" events from the video element... Calling it on "loadeddata" wouldn't works. Changing the ".src" property from the video element works exactly as the ".load()" function.
$( document ).ready( function()
{
var scene = document.querySelector('a-scene');
var video = document.getElementById("video");
var t = 0;
var src = video.src;
if (scene.hasLoaded) {
run();
} else {
scene.addEventListener('loaded', run);
}
function run () {
scene.addEventListener('enter-vr', enterVR);
scene.addEventListener('exit-vr', exitVR);
}
function enterVR() {
t = video.currentTime;
video.load();
video.addEventListener('loadeddata', loadData, false);
}
function exitVR() {
}
function loadData() {
video.addEventListener('playing', playing, false);
video.removeEventListener('loadeddata', loadData);
}
function playing() {
video.addEventListener('timeupdate', setTime, false);
video.removeEventListener('playing', playing);
}
function setTime() {
video.addEventListener('timeupdate', setTime2, false);
video.removeEventListener('timeupdate', setTime);
}
function setTime2() {
video.addEventListener('timeupdate', setTime3, false);
video.removeEventListener('timeupdate', setTime2);
}
function setTime3() {
video.currentTime = t;
video.removeEventListener('timeupdate', setTime3);
}
});
Using URI to set the timing:
video.src = src + "#t=" + t;
Doesn't work either.
- A-Frame Version: 0.2.0
- Platform/Device: Chrome (537.36) / Nexus 5X (Android: 6.0.1)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the videosphere transition from mono playback into VR on the stated Android Chrome devices, focusing on the enter-vr event and the video element lifecycle. Compare this behavior with the provided load() workaround and verify that entering VR no longer freezes or crashes playback and that the current time can be preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100