ppt转flash kindeditor上传视频全屏问题

最近要增加页面的ppt显示功能,于是考虑把ppt转成flash,在网上搜到了ispingfree,链接: https://pan.baidu.com/s/1QZzx6qmdsnwzWCuULXzUOw提取码: e25c 

用了下果然可以把ppt转成swf文件,接下来就是上传并在前台显示了,后台的新闻编辑器是kindeditor,用kindeditor上传视频后发现无法实现全屏于是开始分析,发现kindeditor上传视频时会生成embed标签

  <embed src="/jgsyzx/attached/media/20181113/20181113191524_639.swf" type="application/x-shockwave-flash" width="550" height="400" autostart="false" loop="true" >

但是这个embed标签没有allowFullScreen属性,一种想法是生成页面后在页面中使用jquery对embed标签添加allowFullScreen=true,另一种是后台保存到数据库之前添加.第一种想法尝试过之后,发现不成功,不知道是不是因为浏览器的安全限制.于是尝试第二种想法,使用jsoup对生成的embed标签添加allowFullScreen属性

 1 /*解析embed标签,加入控制全屏属性*/
 2     private void setFullScreen(News news) {
 3         String content = news.getContent();
 4         Document doc = Jsoup.parse(content);
 5         Elements elements = doc.getElementsByTag("embed");
 6         if(elements != null) {
 7             Element embed = elements.first();
 8             if(embed != null) {
 9                 embed.attr("allowFullScreen","true");
10             }
11         }else {
12             return;
13         }
14          news.setContent(doc.toString());
15     }

这种想法经检测是可行的


原文地址:https://www.cnblogs.com/tele-share/p/9954335.html