blackberry / BB10-WebWorks-Framework

The BB10 WebWorks Framework is packaged within an application BAR file to run on a BB10 device (or simulator)
61 stars 34 forks source link

getUserMedia does not work in a WebWorks application #274

Open ctetreault opened 12 years ago

ctetreault commented 12 years ago

.getUserMedia does not appear to work when packaged in a WebWorks application. It works fine when the app is run in the browser.

It does not ask for permissions when the application loads, the way it does in the browser. This may be related.

nukulb commented 12 years ago

@erik54 - its just permission, I think you just need to listen to the media events.

in the browser it shows up as a toast.

RonMen commented 12 years ago

I'm using the following source code in the browser and also within an WebWork apps screen:

<div data-bb-type="screen">
    <video autoplay controls></video>

    <script type="text/javascript">
        function onFailSoHard(ex) {
            console.log(ex);
        }

        navigator.getUserMedia = navigator.getUserMedia||navigator.webkitGetUserMedia||false;

        if(!!navigator.getUserMedia) {
          navigator.getUserMedia({audio: true, video: true}, function(stream) {
            var video = document.querySelector('video');
            video.src = ('webkitURL' in window)?window.webkitURL.createObjectURL(stream):stream;
          }, onFailSoHard);
        } else {
           alert("not supported"); // fallback.
        }
    </script>
</div>

This is working in the browser with a toast message asking for the permission to use the front or rear camera, but I needed to remove the <meta name="viewport" ... /> tag from the HTML head to get it working.

The issues I figured out in the browser can be seen in the pictures below.

  1. You can see the how it is embedded and it seems little bit buggy to show the "tab..." text there. Viewport using HTML5 getUserMedia
  2. When the device comes back from standby the following issue can be seen: Viewport using HTML5 getUserMedia

So it seems to be like a browser tab in the videos viewport and also seem to be really buggy at this time of usage.

On the other hand I tried to use the above source code together with permission <rim:permit>use_camera</rim:permit> and it doesn't seem to work for me like @ctetreault mentioned. It asked me for permission to use the camera but it shows nothing in the video element like using it from the website. Something missing there??

I'm on BB10 Dev Alpha OS 10.0.9.338 using the latest WebWorks SDK 1.0.2.9.

nukulb commented 12 years ago

Yes we need to investigate this.

~Nukul

From: RonMen [mailto:notifications@github.com] Sent: Friday, October 05, 2012 05:25 AM To: blackberry/BB10-WebWorks-Framework BB10-WebWorks-Framework@noreply.github.com Cc: Nukul Bhasin Subject: Re: [BB10-WebWorks-Framework] getUserMedia does not work in a WebWorks application (#274)

I'm using the following source code in the browser and also within an WebWork apps screen:

This is working in the browser with a toast message asking for the permission to use the front or rear camera, but I needed to remove the <meta name="viewport" ... /> tag from the HTML head to get it working.

The issues I figured out in the browser can be seen in the pictures below.

  1. You can see the how it is embedded and it seems little bit buggy to show the "tab..." text there. [Viewport using HTML5 getUserMedia] https://a248.e.akamai.net/camo.github.com/68c6bfb532e75f609d101940f038039088af34f8/687474703a2f2f696d616765736861636b2e75732f612f696d673834312f393633322f696d6730303030303031322e706e67
  2. When the device comes back from standby the following issue can be seen: [Viewport using HTML5 getUserMedia] https://a248.e.akamai.net/camo.github.com/ac9622c62d92a3ad4e7f21baf88607bb9b492d3a/687474703a2f2f696d616765736861636b2e75732f612f696d673431312f383438392f696d6730303030303031332e706e67

So it seems to be like a browser tab in the videos viewport and also seem to be really buggy at this time of usage.

On the other hand I tried to use the above source code together with permission rim:permituse_camera/rim:permit and it doesn't seem to work for me like @ctetreaulthttps://github.com/ctetreault mentioned. It asked me for permission to use the camera but it shows nothing in the video element like using it from the website. Something missing there??

I'm on BB10 Dev Alpha OS 10.0.9.338 using the latest WebWorks SDK 1.0.2.9.

— Reply to this email directly or view it on GitHubhttps://github.com/blackberry/BB10-WebWorks-Framework/issues/274#issuecomment-9170013.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

RonMen commented 12 years ago

BTW: will it be possible to use the getUserMedia and send the stream using something like WebRTC in the future like discussed here: http://www.html5rocks.com/en/tutorials/webrtc/basics/

EricLeiLi commented 12 years ago

@RonMen We have created the user story to investigate it and will do as soon as we can.

RonMen commented 12 years ago

That sounds interesting. Hope you got something running. Would be really great to work with that not only in browser like Chrome supporting a peer2peer connection.

RonMen commented 12 years ago

Hi there. I updated my Dev Alpha to OS version 10.0.9.1103 and wanted to give it another try with this but it doesn't work like expected, no dialog comes up to request permission for camera and also nothing else happens, also no errors in web inspector.

Since the window.* and navigator.* got extended with some new functionality I wanted to go deeper into it, implementing an app to connect to a webRTC server running here since the window.webkitRTCPeerConnection (and window.webkitPeerConnection00) available, so I guess I could give it a try to get an app up an running?

Some app samples out thee showing how it works?

kwallis commented 12 years ago

Hey there. You are also using the latest WebWorks SDK? Do you have the access_camera permission element in your config.xml as well?

This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

RonMen commented 12 years ago

Hi Ken. I updated to WebWorks SDK 1.0.3.8 yesterday before going on with the getUserMedia. I also use <rim:permit>use_camera</rim:permit> within the config.xml of the project. The provided source code of my earlier posts was working only in the browser, but right now it isn't working, neither in the browser nor as an app.

nukulb commented 12 years ago

@tohman - can you please help @RonMen get up and running? since @tohman enabled the feature in WebWorks

RonMen commented 12 years ago

THX @nukulb, would be very nice if @tohman can assist to get it up and running!

tohman commented 12 years ago

@RonMen, it works for me with WebWorks SDK 1.0.3.8 and 10.0.9.1103 build. Please see code I used below. I saw you already have use_camera capability in your config.xml.

config.xml

<rim:permissions>
  <rim:permit>use_camera</rim:permit>
</rim:permissions>

index.html

<html>
<head>
    <title>getUserMedia</title>
</head>
<body>
    <div data-bb-type="screen">
        <video autoplay controls></video>

        <script src="local:///chrome/webworks.js" type="text/javascript"></script>
        <script type="text/javascript">
            function onFailSoHard(ex) {
                console.log(ex);
            }

            navigator.getUserMedia = navigator.getUserMedia||navigator.webkitGetUserMedia||false;

            if(!!navigator.getUserMedia) {
              navigator.getUserMedia({audio: true, video: true}, function(stream) {
                var video = document.querySelector('video');
                video.src = ('webkitURL' in window)?window.webkitURL.createObjectURL(stream):stream;
              }, onFailSoHard);
            } else {
               alert("not supported"); // fallback.
            }
        </script>
    </div>
</body>
</html>
RonMen commented 12 years ago

Hi @tohman. I tried again, but it doesn't work on BB10 Dev Alpha with the code on latest WebWorks 1.0.3.8 and BB10 OS 10.0.9.1103 available for me.

tohman commented 12 years ago

@RonMen, can you send me your widget with that code and I can look into it and to try it on?

RonMen commented 12 years ago

@tohman, I send you an email togehter with the attached project files and some more questions. Looking forward for an answer. THX