Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for Chrome Android browser #71

Closed
fajarmf opened this issue Apr 25, 2016 · 23 comments
Closed

Improve support for Chrome Android browser #71

fajarmf opened this issue Apr 25, 2016 · 23 comments
Labels

Comments

@fajarmf
Copy link

fajarmf commented Apr 25, 2016

Currently on Android browser the recording doesn't work. I tried the demo for video and the recorder doesn't start after clicking it.

Any plan on supporting them?

Thank you

@thijstriemstra
Copy link
Member

thijstriemstra commented Apr 25, 2016

@fajarmf what version of the android browser? Can you add a screenshot?

@fajarmf fajarmf changed the title Support for Android browser Support for Chrome Android browser Apr 27, 2016
@fajarmf
Copy link
Author

fajarmf commented Apr 27, 2016

My mistake, it was a chrome browser. and the screenshot is attached.
screenshot_2016-04-27-08-07-07_com android chrome

@thijstriemstra
Copy link
Member

thijstriemstra commented Apr 29, 2016

@fajarmf is there any way you can get a console log for this? I'm hoping we can use that to figure out what's going on here. Also please check one of the official examples at https://collab-project.github.io/videojs-record and use that to debug this.

@thijstriemstra
Copy link
Member

I've used the DevTools to debug this issue and I managed to record a audio/video clip but the playback of this clip failed with this error:

video.min.js:22 VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. 

screen shot 2016-05-11 at 14 28 50

@thijstriemstra
Copy link
Member

From https://developers.google.com/web/updates/2016/01/mediarecorder: Audio recording works in Firefox and in Chrome 49 and above; Chrome 47 and 48 only support video recording.

I tested audio+video in the previous comment so that explains the error. @fajarmf which one did you try?

@thijstriemstra
Copy link
Member

thijstriemstra commented May 11, 2016

Here's a bug tracking the MEDIA_ERR_SRC_NOT_SUPPORTED error: https://bugs.chromium.org/p/chromium/issues/detail?id=253465

There seems to be a workaround, can you give that a try @fajarmf? Does this example work correctly on your Android Chrome: https://webrtc.github.io/samples/src/content/getusermedia/record/

@ignl
Copy link

ignl commented Aug 2, 2016

Hmm for me it also doesn't work on mobile chrome - simply nothing happens. https://webrtc.github.io/samples/src/content/getusermedia/record/ asks for permissions but videojs-record does not. https://www.webrtc-experiment.com/RecordRTC/ does not ask for permission but it starts recording. Will try to find out what's wrong later.

@ignl
Copy link

ignl commented Aug 8, 2016

OK I tried to debug but there are no errors and actually I found out that it kinda works, but reaaaallllyyy slow. Like press button then wait 3 min for video to show up (with pressing that button repeatedly) then press record then wait again and with multiple tries it's possible to record something. So it seems that it does work it just so incredibly slow it's unusable with android chrome. Video is also very slow and choppy while recording. https://webrtc.github.io/samples/src/content/getusermedia/record/ is really fast compared and original RecordRTC is slower but usable. I have used HTC M8 and android chrome 51.

@thijstriemstra
Copy link
Member

@ignl thanks for the report. I suspect the code that updates the current time for the video.js player is slow as it happens continuously. What if you comment out the statements on https://github.com/collab-project/videojs-record/blob/master/src/js/videojs.record.js#L1231 and https://github.com/collab-project/videojs-record/blob/master/src/js/videojs.record.js#L1257?

@ignl
Copy link

ignl commented Aug 8, 2016

Ok I have checked on firefox and video performance seems similar. Maybe chrome is more sensitive to this. I will test it tomorrow as it requires https so i will need to deploy my app or work around that security requirement. However there is also something wrong with the click event as it hardly works on first easy touch on android. For the firefox I also had to try several times until it asked me permission for cam and mic same with chrome just takes much longer. Maybe will need to try and play with different events.

@ignl
Copy link

ignl commented Aug 16, 2016

I have added touchstart event everywhere where there was a click event. Something like this:

DeviceButton = videojs.extend(VjsButton,
    {
        /** @constructor */
        constructor: function(player, options)
        {
            VjsButton.call(this, player, options);

            this.on('touchstart', this.onClick);
            this.on('click', this.onClick);
        }
    });
    DeviceButton.prototype.onClick = function(e)
    {
        e.preventDefault();
        // stop this event before it bubbles up
        e.stopImmediatePropagation();

        // open device dialog
        this.player().recorder.getDevice();
    };

Not sure if it is a good approach, I didn't find any problems like ghost click event triggering but maybe its only on my device. Maybe need a better solution like the ones discussed here.

Camera view is laggy and choppy on mobile chrome, and it is so even before starting recording so proposed fix didn't help. I tried on recordrtc example again and this time recording was also really choppy so I think the problem could be with record rtc.

Also tried on htc browser and it didn't work at all, but the problem is probably that it is based on an old version of chrome so no surprises.

@thijstriemstra
Copy link
Member

Did adding touch events help?

@ignl
Copy link

ignl commented Aug 16, 2016

Yes mobile browsers now works fine on my htc just maybe need more testing with more devices. But yeah touch events should be added to the project.

@thijstriemstra
Copy link
Member

@ignl cool, could you add a PR?

@ignl
Copy link

ignl commented Aug 17, 2016

Ok I will test my application a bit more, and when finish will try to do it

@thijstriemstra thijstriemstra changed the title Support for Chrome Android browser Improve support for Chrome Android browser Sep 14, 2016
@thijstriemstra
Copy link
Member

It looks like the only event video.js subscribes to is the tap event as seen here. This doesn't seem to be a native browser event but a custom video.js event indicating there is support for touch events as seen here. So it seems we need to listen for tap events as well as the current click events.

@thijstriemstra
Copy link
Member

@ignl if you have time, please test the latest. I'll put out a new release in a few days.

@ignl
Copy link

ignl commented Sep 21, 2016

Did you try it yourself? If I am not mistaken "tap" is jquery mobile event so it would add(?) additional dependency? Or already exists with video.js? I had some limited testing with "touchstart" event (same as you, just instead of "tap" used "touchstart" and added preventDefault in function) and so far so good. I will test "tap" today a bit later. Sorry that I didn't made PR yet (was on my todo), I was deploying my app. Anyway it's pretty trivial just need to choose and add event and test that everything works.

@ignl
Copy link

ignl commented Sep 21, 2016

I will test "tap" a bit later today.

@ignl
Copy link

ignl commented Sep 21, 2016

OK "tap" event works for me.

@thijstriemstra
Copy link
Member

Did I try it myself? Uh, of course?? And if you followed the link in my previous comment explaining tap, you'd see it's a custom video.js event that combines touchstart and touchstop events.

Thanks for testing!

@ignl
Copy link

ignl commented Sep 21, 2016

Yeah saw "tap" event before when looking for mobile event, but I thought it will require additional dependency so it's my bad research :)

@thijstriemstra
Copy link
Member

Going to close this, if there are any other mobile issues, open a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants