songz / cordova-plugin-opentok

Cordova Plugin for OpenTok - add webrtc video to your iOS or Android App
Other
162 stars 270 forks source link

When you scroll the video doesn't come with or follow the scrolling. #153

Closed byronalfonso closed 9 years ago

byronalfonso commented 9 years ago

Greetings! I'm currently using opentok 64bit on top of ionic framework (I tested it on an actual IOS device) and I got an issue on styling the video. Initially it loads fine. It looks ok. The problem begins when you start scrolling... When you scroll the video doesn't come with or follow the scrolling. It's just stuck on it's initial position. I tried using TB.updateViews() just as songz suggested on this stackoverflow thread -> http://stackoverflow.com/questions/26007411/unable-to-scroll-video-divs-in-opentok-cordova-application but it doesn't seem to work.

Here's how I tried to use TB.updateViews() on my simple sol'n.

  1. On my controller I created a $scope.testScroll = function(){ TB.updateViews(); }
  2. Then I've added on-scroll on my ion-content, <ion-content on-scroll="testScroll()">

I tried putting an alert to check if the function work and it does. I'm not sure whether I'm using the TB.updateViews() correctly? Can anyone help? Thanks!

aullman commented 9 years ago

It might help if I explain how this is working to you. The Cordova plugin uses the OpenTok SDK and places native iOS views for the Publisher and Subscriber on top of a WebView. When you call updateViews() it updates the sizing and positioning of these overlayed views to match the elements inside the WebView. Are you talking about scrolling the video views off the page? That may not be possible, although I haven't tried it. It's also possible that updateViews isn't accounting for scroll position.

The code is at: https://github.com/songz/cordova-plugin-opentok/blob/2313ec014c95b5a53f232d53bcb9d2c29abb7aaa/src/js/OTHelpers.coffee#L10

I'd have a look at updateViews and see if that would be calculating the positions correctly.

byronalfonso commented 9 years ago

@aullman I was able to fix the issue by changing the styles on my elements and by not implementing the updateViews with the scroll. I figured that it wouldn't make sense anyway to make the video scroll anyway so I just used the updateViews to position my video containers perfectly on their initial load. Thanks for the help!

aullman commented 9 years ago

@bawun good to hear, no worries :)