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

mpegts.ErrorTypes API 调用无效? #178

Open
tangxu98 opened this issue Mar 28, 2024 · 0 comments
Open

mpegts.ErrorTypes API 调用无效? #178

tangxu98 opened this issue Mar 28, 2024 · 0 comments

Comments

@tangxu98
Copy link

问题描述:
项目遇到一个需求,需要在直播流断流以后重新拉流,在本地拉了一个摄像头的流,然后插拔网线模拟断流的效果,但是 mpegts.ErrorTypes 这个 api 并没有输出任何信息,请问是调用方法出错了吗?
以下是代码,请教以下:

<script> import mpegts from 'mpegts.js'; export default { data() { return { flvPlayer: null, tag: '', timer: null, isPlay: false, // 屏幕录制 mainVideo: null, mediaRecorder: null, videoData: [], isRecording: false, }; }, methods: { /** * 创建 mpegts 实例 */ initFlv(videoUrl) { const ele = this.$refs.container console.log(mpegts.isSupported()); console.log(mpegts.getFeatureList()); if (ele && mpegts.isSupported()) { this.flvPlayer = mpegts.createPlayer({ type: 'flv', isLive: true, hasAudio: false, cors: true, url: videoUrl, }, { enableWorker: false, enableStashBuffer: true, stashInitialSize: 384, lazyLoad: false, lazyLoadMaxDuration: 0.2, deferLoadAfterSourceOpen: false, liveBufferLatencyChasing: true, liveBufferLatencyMaxLatency: 1.5, liveBufferLatencyMinRemain: 0.3 }); this.flvPlayer.attachMediaElement(ele); this.flvPlayer.load() this.flvPlayer.play() this.flvPlayer.on(mpegts.Events.STATISTICS_INFO, (statisticsInfo) => { console.log(statisticsInfo.speed, 'speed'); }); this.flvPlayer.on(mpegts.Events.ERROR, (e) => { console.log(e, 'ERROR'); }); this.flvPlayer.on(mpegts.ErrorTypes.NETWORK_ERROR, (message) => { console.log(message, 'ERROR'); console.log('NETWORK_ERROR'); }); } },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant