vidformer 0.4.0__tar.gz → 0.4.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vidformer
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: A Python library for creating and viewing videos with vidformer.
5
5
  Author-email: Dominik Winecki <dominikwinecki@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -1,6 +1,6 @@
1
1
  """A Python library for creating and viewing videos with vidformer."""
2
2
 
3
- __version__ = "0.4.0"
3
+ __version__ = "0.4.1"
4
4
 
5
5
  import subprocess
6
6
  from fractions import Fraction
@@ -80,8 +80,6 @@ class Spec:
80
80
  def play(self, server, method="html"):
81
81
  """Play the video live in the notebook."""
82
82
 
83
- from IPython.display import IFrame, HTML
84
-
85
83
  spec, sources, filters = self._to_json_spec()
86
84
  spec_json_bytes = json.dumps(spec).encode("utf-8")
87
85
  spec_obj_json_gzip = gzip.compress(spec_json_bytes, compresslevel=1)
@@ -112,9 +110,17 @@ class Spec:
112
110
  namespace = resp["namespace"]
113
111
  hls_js_url = server.hls_js_url()
114
112
 
113
+ if method == "link":
114
+ return hls_video_url
115
+ if method == "player":
116
+ return hls_player_url
115
117
  if method == "iframe":
118
+ from IPython.display import IFrame
119
+
116
120
  return IFrame(hls_player_url, width=1280, height=720)
117
121
  if method == "html":
122
+ from IPython.display import HTML
123
+
118
124
  # We add a namespace to the video element to avoid conflicts with other videos
119
125
  html_code = f"""
120
126
  <!DOCTYPE html>
@@ -439,6 +445,14 @@ class Source:
439
445
  raise Exception("Source index must be a Fraction")
440
446
  return SourceExpr(self, idx, False)
441
447
 
448
+ def play(self, *args, **kwargs):
449
+ """Play the video live in the notebook."""
450
+
451
+ domain = self.ts()
452
+ render = lambda t, i: self[t]
453
+ spec = Spec(domain, render, self.fmt())
454
+ return spec.play(*args, **kwargs)
455
+
442
456
 
443
457
  class StorageService:
444
458
  def __init__(self, service: str, **kwargs):
File without changes
File without changes