Comments (4)
@webdif I don't believe you can use videoDisabled
and videoEnabled
with a Publisher. Those are events on the Subscriber. Please see:
https://tokbox.com/developer/sdks/js/reference/Subscriber.html#.event:videoEnabled
https://tokbox.com/developer/sdks/js/reference/Subscriber.html#.event:videoDisabled
These two Subscriber events are explained in detail in the above links. Is there something confusing you about them?
As for the Publisher callback props, onPublish
is called when a publisher successfully publishes to the session, equivalent to the callback of Session#publish(). And onError
is called when there is an error either initialising the publisher or publishing to the session.
If this is still confusing, maybe you can describe what you're trying to achieve and I can suggest the correct usage.
from opentok-react.
Thanks a lot for your response and your help 👍
Indeed, I have these events on <OTSubscriber>
, but I mixed things up reading the docs and in the code on this issue. Sorry about that! But I'm still want to understand better the difference of these events and onSubscribe
/ onError
.
What I'm trying to achieve is to update my UI when something is changing.
Currently, I fire redux actions on videoEnabled
and videoDisabled
, to tell my user something like "Hey, the video has been disabled to preserve audio".
It's working, but I often have some errors in console. I saw that 0.4.0 add some sucess/error handlings with convenient callback, so I'm trying to implement these, and have a better management of errors, disconnect, reconnect. For example, a log in chrome console that showing errors or warning that are not catched yet:
from opentok-react.
Sure, no problem.
The onSubcribe
and onError
props will be called on success/failure of the Session#subscribe() call, but this only happens once at the start of a subscription.
videoEnabled
and videoDisabled
may be emitted multiple times after a successful subscription. They can be emitted for a few reasons (publishVideo, subscribeToVideo, quality) but these are all events that happen on purpose, either decided by the publisher, subscriber or OpenTok Media Router.
They will not be called for connectivity issues. You'll likely want to listen for Session events such as sessionConnected, sessionDisconnected, sessionReconnected and sessionReconnecting. Then pass down the event to OTSubscriber
child components. I did something similar in the example app.
The session events are defined here:
They are passed into OTSession
here:
And the connectivity state is passed down to the child component here:
from opentok-react.
Thanks a lot for all this! I have some docs to read 🤓
from opentok-react.
Related Issues (20)
- Changing audioSource doesn't work
- Is this project being maintained? HOT 4
- Opentok JS sdk considers media volume instead of phone volume.
- Doesn't work with react v17 HOT 4
- Firefox and Safari compatibility
- In Safari on iOS 15, the video is rotated and flickered, if the app is run in the background
- Timeout error and please find attached screen for the react api
- What about Feature: [WebRTC] Deprecate and Remove Plan B ?
- Opentok publisher video always showing endless loading on Safari in IPhone
- How can we show network disconnected message to both connected users?
- Support stricter Content Security Policies
- prop-types-15.5.10.tgz: 4 vulnerabilities (highest severity is: 7.5)
- lodash-4.17.4.tgz: 7 vulnerabilities (highest severity is: 9.1)
- How to stream system audio along with screenshare
- Share only a portion of screen
- Option to mute microphone of the publisher through a button
- applyVideoFilter not working HOT 1
- cannot screen share
- sessionDisconnected, sessionReconnected, sessionReconnecting events not triggered on internet connection change HOT 2
- applyVideoFilter: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentok-react.