From a6507b50369b05adda6be4659b152c38fe9b9077 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 23:06:52 +0800 Subject: [PATCH] 1 --- app/services/videos/batch_publish_service.rb | 8 ++++---- app/services/videos/dispatch_callback_service.rb | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 8a97f74d1..19f611b3b 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -32,10 +32,10 @@ class Videos::BatchPublishService < ApplicationService # 标清转码为h264 if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265') video.transcoded = true - Rails.logger.info("####video.uuid:#{video.uuid}") - result = AliyunVod::Service.get_play_info(video.uuid) - Rails.logger.info("####video.result:#{result}") - video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] + #Rails.logger.info("####video.uuid:#{video.uuid}") + #result = AliyunVod::Service.get_play_info(video.uuid) + # Rails.logger.info("####video.result:#{result}") + #video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 6bfb9f70d..ca59fd4b6 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,8 +18,9 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - - video.update!(cover_url: params['CoverUrl']) + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result + video.update!(cover_url: params['CoverUrl'], play_url: play_url) when 'StreamTranscodeComplete' then # 转码完成 return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true)