예제 #1
0
 def _create_mux_asset(self, s3_url):
     try:
         assets_api = self._create_mux_client()
         input_settings = [mux_python.InputSettings(url=s3_url)]
         create_asset_request = mux_python.CreateAssetRequest(
             input=input_settings)
         create_asset_response = assets_api.create_asset(
             create_asset_request)
         print("RESONSE : ")
         print(create_asset_response)
         return create_asset_response.data.id
     except Exception as e:
         print("ERROR:", e)
         return None
예제 #2
0
import os
import time
import mux_python
from mux_python.rest import ApiException

# Authentication Setup
configuration = mux_python.Configuration()
configuration.username = os.environ['MUX_TOKEN_ID']
configuration.password = os.environ['MUX_TOKEN_SECRET']

# API Client Initialization
assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))

# Create an asset
input_settings = [
    mux_python.InputSettings(
        url='https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4')
]
create_asset_request = mux_python.CreateAssetRequest(
    input=input_settings,
    playback_policy=[mux_python.PlaybackPolicy.PUBLIC],
    mp4_support="standard")

create_asset_response = assets_api.create_asset(create_asset_request)
print("Created Asset ID: " + create_asset_response.data.id)

# Wait for the asset to become ready, and then print its playback URL
if create_asset_response.data.status != 'ready':

    print("Waiting for asset to become ready...")
    while True:
        asset_response = assets_api.get_asset(create_asset_response.data.id)
예제 #3
0
    def create_asset(self):
        # Create an asset
        self.input_settings = [mux_python.InputSettings(url=self.video)]
        self.create_asset_request = mux_python.CreateAssetRequest(input=self.input_settings, playback_policy=[mux_python.PlaybackPolicy.PUBLIC], mp4_support="standard")

        self.create_asset_response = self.assets_api.create_asset(self.create_asset_request)
예제 #4
0
import logger

# Exercises all asset operations.

# Authentication Setup
configuration = mux_python.Configuration()
configuration.username = os.environ['MUX_TOKEN_ID']
configuration.password = os.environ['MUX_TOKEN_SECRET']

# API Client Initialization
assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))
playback_ids_api = mux_python.PlaybackIDApi(mux_python.ApiClient(configuration))

# ========== create-asset ==========
add_captions = mux_python.CreateTrackRequest(url="https://tears-of-steel-subtitles.s3.amazonaws.com/tears-fr.vtt", type="text", text_type="subtitles", language_code="fr", closed_captions=False, name="French")
input_settings = [mux_python.InputSettings(url='https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4'), add_captions]
create_asset_request = mux_python.CreateAssetRequest(input=input_settings)
create_asset_response = assets_api.create_asset(create_asset_request)
logger.print_debug("Created Asset: " + str(create_asset_response))
assert create_asset_response != None
assert create_asset_response.data.id != None
print("create-asset OK ✅")

# ========== list-assets ==========
list_assets_response = assets_api.list_assets()
logger.print_debug ("Got List Asset Response: " + str(list_assets_response))
assert list_assets_response != None
assert list_assets_response.data[0].id == create_asset_response.data.id
print("list-assets OK ✅")

# Wait for the asset to become ready...