eluv-io / elv-live-js

Eluvio Live JavaScript SDK
MIT License
4 stars 3 forks source link

Insertion time recordings #127

Closed elv-serban closed 1 year ago

elv-serban commented 1 year ago

Change structure of playout_config 'interleaves' to use a map keyed by the recording sequence (recoding sequence is 1-based so the first recording key is "1")

Read target hash info and extract audio and video segment durations (replace hardcoded values).

Bonus:

Example live_recording/playout_config:

  "playout_config": {
    "interleaves": {
      "1": [
        {
          "audio_abr_duration": 1.9969160997732427,
          "duration": 100,
          "insertion_time": 720.7869999408722,
          "playout": "/qfab/hq__6Xqy1zQfdy8F3Uead43SEw3hGHkrd5LtdgnYSxc1QbsmLwXWG25NCCZAWnedRYhg4KMDgwozow/rep/playout",
          "video_abr_duration": 2.002
        },
        {
          "audio_abr_duration": 1.9969160997732427,
          "duration": 100,
          "insertion_time": 724.9679999351501,
          "playout": "/qfab/hq__6Xqy1zQfdy8F3Uead43SEw3hGHkrd5LtdgnYSxc1QbsmLwXWG25NCCZAWnedRYhg4KMDgwozow/rep/playout",
          "video_abr_duration": 2.002
        },
        {
          "audio_abr_duration": 1.9969160997732427,
          "duration": 11,
          "insertion_time": 1492.917000055313,
          "playout": "/qfab/hq__6Xqy1zQfdy8F3Uead43SEw3hGHkrd5LtdgnYSxc1QbsmLwXWG25NCCZAWnedRYhg4KMDgwozow/rep/playout",
          "video_abr_duration": 2.002
        }
      ]
    },
    "rebroadcast_start_time_sec_epoch": 0,
    "vod_enabled": false
  }
elv-reza commented 1 year ago

The help for ad insertion is not correct:

./elv-stream 
Eluvio Live Stream CLI

Usage: elv-stream <command>

Commands:
  init <stream>                            Initialize media and DRM
                                           configuration for the stream object.
  create <stream>                          Create a new live stream for this
                                           stream object.
  terminate <stream>                       End the current live stream for this
                                           object.
  start <stream>                           Start or resume current live stream
                                           if not running.
  status <stream>                          Status of the currently active live
                                           stream.
  reset <stream>                           Reset the currently active live
                                           stream.
  stop <stream>                            Pauses the currently active live
                                           stream.
  insertion <stream> <time> <target_hash>  Pauses the currently active live
                                           stream.

Options:
      --version  Show version number                                   [boolean]
  -v, --verbose  Verbose mode                                          [boolean]
      --help     Show help                                             [boolean]
elv-reza commented 1 year ago

The script has to check the duration of created ad/interleave against the duration of the target object (the duration of created ad can not be bigger than the duration of target object). In the other words:

if duration_of_created_ad > dureation_of_target_object {
  generate an error 
}