| | |
| | | package com.yeshi.buwan.util.video; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.videos.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.videos.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.imp.juhe.FunTVService; |
| | | import com.yeshi.buwan.service.imp.juhe.IqiyiService; |
| | | import com.yeshi.buwan.service.imp.juhe.SoHuService; |
| | | import com.yeshi.buwan.service.inter.juhe.*; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; |
| | | import com.yeshi.buwan.videos.sohu.SoHuUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.videos.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.videos.bilibili.BilibiliUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.videos.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.videos.sohu.SoHuUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.videos.youku.YouKuUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.slf4j.Logger; |
| | |
| | | private VideoResourceUtil videoResourceUtil; |
| | | |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#acceptData.version+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) throws VideoPlayException { |
| | | playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid)); |
| | | //判断resourceId是否在允许播放的来源列表中 |
| | | |
| | | List<Long> resourceIds = videoResourceUtil.getAvailablePlayResourceIds(new DetailSystem(detailSystemId), acceptData.getVersion(), acceptData.getChannel()); |
| | | |
| | | if (resourceIds == null || !resourceIds.contains(Long.parseLong(resourceid + ""))) { |
| | | throw new VideoPlayException(1, "指定播放源无法播放"); |
| | | } |
| | |
| | | playUrl = funTV2Service.getPlayUrl(acceptData, detailSystemId, resourceid, id, videoid); |
| | | break; |
| | | case FunTVUtil.RESOURCE_ID: |
| | | playUrl = funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | playUrl = funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid, acceptData.getChannel(), acceptData.getVersion()); |
| | | break; |
| | | case SoHuUtil.RESOURCE_ID: |
| | | playUrl = soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | |
| | | //韩剧 |
| | | if ("48".equalsIgnoreCase(acceptData.getDetailSystem().getId())) { |
| | | //正在上线 |
| | | if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) { |
| | | //需要原生播放器 |
| | | if (oldId != null && oldId.startsWith("native_")) { |
| | | if (playUrl.getPlayType() == 1) { |
| | | //原生播放器播放 |
| | | playUrl.setPlayType(2); |
| | | playUrl.setUrl("https://jx.parwix.com:4433/player/?url=" + playUrl.getUrl()); |
| | | } |
| | | } |
| | | } |
| | | //TODO 上线的时候开启,防止误操作 |
| | | // if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) { |
| | | // //需要原生播放器 |
| | | // if (oldId != null && oldId.startsWith("native_")) { |
| | | // if (playUrl.getPlayType() == 1) { |
| | | // //原生播放器播放 |
| | | // playUrl.setPlayType(2); |
| | | // playUrl.setUrl("https://jx.parwix.com:4433/player/?url=" + playUrl.getUrl()); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |