Skip to content

Commit b0ff606

Browse files
committed
ISVJ-8227 大屏中对地图属性值为空值的对象进行点选查询视频显示异常 review by luox
1 parent a0bdc37 commit b0ff606

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

src/common/video-player/VideoPlayer.vue

+11-4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ interface playerOptions {
6363
poster?: string;
6464
controlBar?: any;
6565
notSupportedMessage?: string;
66+
suppressNotSupportedError?: Boolean;
6667
techOrder?: Array<string>;
6768
flash?: any;
6869
flvjs?: any;
@@ -197,17 +198,23 @@ class SmVideoPlayer extends Vue {
197198
});
198199
}
199200
201+
clearSrc() {
202+
if (this.playerOptions.sources) {
203+
this.playerOptions.sources[0].src = '';
204+
this.modalPlayerOptions.sources[0].src = '';
205+
}
206+
}
207+
200208
handlePlayerOptions(options = this.options) {
201209
if (!this.url) {
210+
this.clearSrc();
211+
this.playerOptions.suppressNotSupportedError = true;
202212
return {};
203213
}
204214
if (!this.checkUrl(this.url)) {
205215
// @ts-ignore
206216
Message.warning(this.$t('warning.unsupportedVideoAddress'), 1);
207-
if (this.playerOptions.sources) {
208-
this.playerOptions.sources[0].src = '';
209-
this.modalPlayerOptions.sources[0].src = '';
210-
}
217+
this.clearSrc();
211218
return {};
212219
}
213220
if (!this.isMatchPosterUrl(options.poster)) {

src/common/video-player/__tests__/VideoPlayer.spec.js

+29
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,33 @@ describe('VideoPlayer.vue', () => {
129129
const res9 = wrapper.vm.isMatchPosterUrl('http://127.0.0.0:8080/a.png');
130130
expect(res9).toBeTruthy();
131131
});
132+
it('clear src when url is empty', async (done) => {
133+
const url = 'http://1.fakeurlAA.flv';
134+
wrapper = mount(SmVideoPlayer, {
135+
localVue,
136+
propsData: {
137+
url,
138+
isFullscreen: false,
139+
ratio: 'origin',
140+
options: {
141+
muted: true,
142+
loop: false,
143+
popupToPlay: true,
144+
autoplay: false,
145+
controlBar: true,
146+
poster: ''
147+
}
148+
},
149+
attachToDocument: 'body'
150+
});
151+
expect(wrapper.find('.sm-component-video-player').exists()).toBe(true);
152+
expect(wrapper.vm.playerOptions.sources[0].src).toBe(url);
153+
expect(wrapper.vm.modalPlayerOptions.sources[0].src).toBe(url);
154+
await wrapper.setProps({
155+
url: ''
156+
});
157+
expect(wrapper.vm.playerOptions.sources[0].src).toBe('');
158+
expect(wrapper.vm.modalPlayerOptions.sources[0].src).toBe('');
159+
done();
160+
});
132161
});

0 commit comments

Comments
 (0)