内容描述

当使用视频组件播放自定义播放地址,出现多余信息小尾巴,参考如下图:
image.png

代码内容

  1. var ENUM = {
  2. video: 'video', // 视频类型
  3. file: 'file', // 文件类型
  4. flow: 'flow', // 视频流
  5. url: 'url', // 自定义链接
  6. hls: 'm3u8',
  7. mp4: 'mp4',
  8. local: 'local',
  9. remoteAddress: 'remoteAddress',
  10. localVideo: 'localVideo',
  11. module: 'module'
  12. };
  13. widget._getCurrentList=function() {
  14. const { fileData, flowData } = this.options;
  15. switch (this.options.videoType) {
  16. case ENUM.module:
  17. return this.getfileVideo(fileData);
  18. case ENUM.file: // 文件视频源
  19. return this.getfileVideo(fileData);
  20. case ENUM.flow:// 视频流
  21. return this.getFlowVideo(flowData);
  22. case ENUM.url: { // 自定义链接
  23. return new Promise((resolve) => {
  24. const tokenName = $('#_csrf_token').attr('name');
  25. const tokenKey = $('#_csrf_token').val();
  26. const file = this.getFileInfo(this.options.videoUrl);
  27. resolve(file ? [{
  28. src: `${this.options.videoUrl}`,
  29. videoType: file.type,
  30. videoSize: '',
  31. videoTime: '',
  32. videoName: file.name
  33. }] : []);
  34. });
  35. }
  36. default:
  37. break;
  38. }
  39. return new Promise((r) => { r([]); });
  40. };
  41. widget.playFlow = function(param) {
  42. if (!param.videoStreaming) {
  43. console.info('please config video-path for event-param "videoStreaming"');
  44. return;
  45. }
  46. const isHttpProtocolFlow = this._IsHttpProtocolFlow(param);
  47. const isHLSProtocolFlow = this._IsHLSProtocolFlow(param);
  48. this.resetVideoContainerHtml();
  49. this.createVideo();
  50. this.addList();
  51. if (isHLSProtocolFlow || isHttpProtocolFlow) {
  52. this.setCurrentSource({
  53. src: `${param.videoStreaming}`,
  54. videoName: '',
  55. videoSize: '',
  56. videoTime: '',
  57. videoType: isHLSProtocolFlow ? ENUM.hls : ENUM.mp4
  58. }, true);
  59. this.eBind();
  60. if (!isHLSProtocolFlow) {
  61. this.autoPlay(true);
  62. }
  63. return;
  64. }
  65. this.getFlowVideo({
  66. httpType: param.protocolType,
  67. location: param.videoStreaming,
  68. params: []
  69. }).then((list) => {
  70. const obj = list[0] || {};
  71. this.setCurrentSource(obj, true);
  72. this.eBind();
  73. });
  74. }
  75. // 修改组件ID
  76. widget.videoInit();

使用说明

1、选择需要播放视频流地址的视频组件;
2、事件->控件初始化->自定义代码
3、将 “代码内容”粘贴到自定义代码内,保存;
4、发布/动态预览 页面,检查视频播放的正确性;