Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

Commit

Permalink
created example for multiple audio streams feature, changed example c…
Browse files Browse the repository at this point in the history
…lass names
  • Loading branch information
Dominic Miglar committed Aug 19, 2015
1 parent 824c152 commit 27ec5fc
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/CreateJobHlsEncryption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'bitcodin'
require 'json'

class TranscodeSintelToDASHAndHLS
class CreateJobHlsEncryption

# create bitcodinAPI
@apiKey = "YOUR_API_KEY"
Expand Down
2 changes: 1 addition & 1 deletion examples/CreateJobPlayreadyDrm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'bitcodin'
require 'json'

class TranscodeSintelToDASHAndHLS
class CreateJobPlayreadyDrm

# create bitcodinAPI
@apiKey = "YOUR_API_KEY"
Expand Down
2 changes: 1 addition & 1 deletion examples/CreateJobWidevineDrm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'bitcodin'
require 'json'

class TranscodeSintelToDASHAndHLS
class CreateJobWidevineDrm

# create bitcodinAPI
@apiKey = "YOUR_API_KEY"
Expand Down
2 changes: 1 addition & 1 deletion examples/CreateJobWidevinePlayreadyDrmCombined.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'bitcodin'
require 'json'

class TranscodeSintelToDASHAndHLS
class CreateJobWidevinePlayreadyDrmCombined

# create bitcodinAPI
@apiKey = "YOUR_API_KEY"
Expand Down
70 changes: 70 additions & 0 deletions examples/CreateJobWithMultipleAudioStreams.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")
require 'bitcodin'
require 'json'

class CreateJobWithMultipleAudioStreams

# create bitcodinAPI
@apiKey = "YOUR_API_KEY"

# INPUT
@bitAPI = Bitcodin::BitcodinAPI.new(@apiKey)
# create http config
@httpConfig = Bitcodin::HTTPInputConfig.new('http://bitbucketireland.s3.amazonaws.com/Sintel-two-audio-streams-short.mkv')
begin
response = @bitAPI.createInput(@httpConfig)
responseData = JSON.parse(response)
@inputId = responseData['inputId']
rescue Exception => e
puts "Could not create Input."
puts e.message
puts e.backtrace.inspect
return nil
end
puts "Created input with ID: #{@inputId}."


# ENCODING PROFILE
@bitAPI = Bitcodin::BitcodinAPI.new(@apiKey)
# create encoding profile
videoStreamConfig1 = Bitcodin::VideoStreamConfig.new(0, 1024000, Profile::MAIN, Preset::STANDARD, 480, 204)
videoStreamConfigs = [videoStreamConfig1]
audioStreamConfig1 = Bitcodin::AudioStreamConfig.new(0, 256000)
audioStreamConfig2 = Bitcodin::AudioStreamConfig.new(1, 256000)
audioStreamConfigs = [audioStreamConfig1, audioStreamConfig2]
encodingProfile = Bitcodin::EncodingProfile.new('MULTIPLE AUDIO STREAMS PROFILE', videoStreamConfigs, audioStreamConfigs)
# parse response to get encoding profile ID
response = bitcodinAPI.createEncodingProfile(encodingProfile)
responseData = JSON.parse(response)
@encodingProfileId = responseData['encodingProfileId']



# JOB
@bitAPI = Bitcodin::BitcodinAPI.new(@apiKey)
# create job config
manifestTypes = []
manifestTypes.push(Bitcodin::ManifestType::MPEG_DASH_MPD)
manifestTypes.push(Bitcodin::ManifestType::HLS_M3U8)

# create audio metadata
audioMetaDataConfiguration0 = AudioMetaDataConfiguration.new(0, 'de', 'Just Sound')
audioMetaDataConfiguration1 = AudioMetaDataConfiguration.new(1, 'en', 'Sound and Voice')

@job = Bitcodin::Job.new(@inputId, @encodingProfileId, manifestTypes, 'standard', nil, nil, [audioMetaDataConfiguration0, audioMetaDataConfiguration1])

# create job
begin
response = @bitAPI.createJob(@job)
responseData = JSON.parse(response)
@jobId = responseData['jobId']
rescue Exception => e
puts "Could not create Job."
puts e.message
puts e.backtrace.inspect
return nil
end

puts "Created job with ID: #{@jobId}."

end
2 changes: 0 additions & 2 deletions test/jobs/bitcodin_api_create_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


module Bitcodin
=begin
class BitcodinApiCreateTest < Test::Unit::TestCase

def setup
Expand Down Expand Up @@ -171,7 +170,6 @@ def teardown

end
end
=end

class BitcodinApiCreateMultipleAudioStreamsTest < Test::Unit::TestCase
def setup
Expand Down

0 comments on commit 27ec5fc

Please sign in to comment.