The live-pusher
component is a feature provided by the WeChat Mini Program platform, and it is used for live streaming. However, in uni-app, if you are trying to use the live-pusher
component and encountering the error “Can not find livePusher,” it could be due to several reasons:
1. Platform Compatibility
- uni-app: The
live-pusher
component is specific to the WeChat Mini Program platform. If you are developing a cross-platform app using uni-app, this component may not be available on all platforms.
- Mini Program: Ensure you are testing on the WeChat Mini Program platform, as
live-pusher
is not available in other platforms like H5, App, or Alipay Mini Program.
2. Component Registration
3. Permissions
- Ensure that your WeChat Mini Program has the necessary permissions to use the
live-pusher
component. You may need to configure this in the Mini Program’s backend settings.
4. uni-app Version
- Ensure that you are using a version of uni-app that supports the
live-pusher
component. If you are using an older version, consider updating to the latest version.
5. Debugging
- Check the console for any additional error messages that might give more context about why the
live-pusher
component is not being found.
- Make sure that the
live-pusher
component is correctly referenced in your project.
6. Custom Components
- If you are using a custom component that wraps
live-pusher
, ensure that the component is correctly imported and used.
Example Usage in WeChat Mini Program:
<live-pusher
id="livePusher"
url="your_rtmp_url"
mode="SD"
autopush
@statechange="onStateChange"
@netstatus="onNetStatus">
</live-pusher>
Page({
onStateChange(e) {
console.log('state change:', e.detail);
},
onNetStatus(e) {
console.log('net status:', e.detail);
}
});