Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

courseware
cxt 5 years ago
commit a4316efbce

@ -154,7 +154,7 @@ class ShixunsController < ApplicationController
@can_fork = {can_fork: "已经职业认证的教师才能fork实训",
certi_url: "/account/certification"}
end
@current_myshixun = @shixun.current_myshixun(current_user)
@current_myshixun = @shixun.current_myshixun(current_user.id)
if @shixun.fork_from
fork_shixun = Shixun.select(:id, :user_id, :name, :identifier).where(id: @shixun.fork_from).first
@fork_from = {name: fork_shixun.name, username: fork_shixun.owner.try(:full_name),

@ -23,7 +23,8 @@ module AliyunVod::Service::Base
result
rescue => ex
::Util.logger_error(ex)
raise AliyunVod::Error, ex.message
""
#raise AliyunVod::Error, ex.message
end
def base_params

@ -26,7 +26,7 @@ module AliyunVod::Service::VideoManage
result
end
# 读取视频编码格式
# 读取视频编码格式与视频格式
def get_meta_code_info(video_id)
params = {
Action: 'GetMezzanineInfo',
@ -36,10 +36,14 @@ module AliyunVod::Service::VideoManage
result = request(:post, params)
Rails.logger.info("#######:#{result['Mezzanine']['VideoStreamList'][0]['CodecName']}")
result['Mezzanine']['VideoStreamList'][0]['CodecName']
codecnamne = result['Mezzanine']['VideoStreamList'].first['CodecName']
file_url = result['Mezzanine']['FileURL']
format = file_url&.split(".")&.last
{codecnamne: codecnamne, format: format}
rescue => e
Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}"
{codecnamne: "", format: ""}
end
# 删除视频信息

@ -210,9 +210,8 @@ class Shixun < ApplicationRecord
end
# 当前用户开启的实训
def current_myshixun(user)
return nil unless user.logged?
myshixuns.find_by(user_id: user.id)
def current_myshixun(user_id)
myshixuns.find_by(user_id: user_id)
end
# 实训技术平台

@ -29,13 +29,14 @@ class Videos::BatchPublishService < ApplicationService
video.status = "published"
end
# 标清转码为h264
if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265')
# 非MP4 H264编码的都转码
code_info = AliyunVod::Service.get_meta_code_info(video.uuid)
Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}")
if code_info[:format] == "mp4" && code_info[:codecnamne].present? && code_info[:codecnamne].start_with?('h264')
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']
result = AliyunVod::Service.get_play_info(video.uuid) rescue nil
play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] if result.present?
video.play_url = play_url
else
AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID)
end

@ -18,9 +18,7 @@ class Videos::DispatchCallbackService < ApplicationService
video.save!
when 'SnapshotComplete' then # 封面截图完成
return if video.cover_url.present?
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)
video.update!(cover_url: params['CoverUrl'])
when 'StreamTranscodeComplete' then # 转码完成
#return if video.play_url.present?
video.update!(play_url: params['FileUrl'], transcoded: true)

@ -4,4 +4,4 @@ You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gitlab-3.2.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install gitlab-3.2.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v3.2.0 and build and push gitlab-3.2.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /></RakeGroup></Settings>
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gitlab-3.2.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install gitlab-3.2.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install gitlab-3.2.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v3.2.0 and build and push gitlab-3.2.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>

@ -62,7 +62,7 @@ namespace :video do
end
task :get_play_url => :environment do
Video.all.each do |video|
Video.where(play_url: nil).each do |video|
result = AliyunVod::Service.get_play_info(video.uuid) rescue nil
if result.present? && result["PlayInfoList"]["PlayInfo"].present?
puts result

@ -3,7 +3,7 @@ namespace :video_transcode do
desc "视频转码成h264"
task :submit => :environment do
Video.find_each do |v|
if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265")
if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265")
p "--- Start submit video trans code #{v.uuid}"
AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e')
else

@ -443,7 +443,7 @@ function VideoUploadList (props) {
<div class="description ">
<div>上传说明目前不支持断点续传单个视频文件最大限制500M单次最多支持3个视频文件上传 </div>
<div>视频规格aviflvf4vm4vmovmp4rmvbswfwebm </div>
<div>温馨提示<span class="color-orange-tip">为了更好播放体验建议您优先上传MP4格式如果您是自己录制视频建议您保存的时候将视频编码设置为AVC(H264)</span></div></div>
<div>温馨提示<span class="color-orange-tip">为了更好播放体验建议您优先上传MP4格式如果您是自己录制视频建议您保存的时候将视频编码设置为AVC(H264)</span></div></div>
</div>
{!noUploads && <React.Fragment>

Loading…
Cancel
Save