vidformer 0.3.1__py3-none-any.whl → 0.4.1__py3-none-any.whl

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.3.1
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
@@ -0,0 +1,4 @@
1
+ vidformer.py,sha256=_pg6zMaFNpmlixGIds6sUF1R4fcMcgpSL2q9Lf5Gk-g,24936
2
+ vidformer-0.4.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
3
+ vidformer-0.4.1.dist-info/METADATA,sha256=WFQ2k0GbMMoV_8O0q0h7tyZVWWZocJODAr_R0WVll6c,643
4
+ vidformer-0.4.1.dist-info/RECORD,,
vidformer.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """A Python library for creating and viewing videos with vidformer."""
2
2
 
3
- __version__ = "0.3.1"
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):
@@ -1,4 +0,0 @@
1
- vidformer.py,sha256=2o3jxO5Ce4-aLHXQ0DNfjZsfwC77x4BvTWjObhvbB_4,24520
2
- vidformer-0.3.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
3
- vidformer-0.3.1.dist-info/METADATA,sha256=ttaoMZ8Xg4pTZp1siqPg_QcGwS4FlD45ilBIan2rsv4,643
4
- vidformer-0.3.1.dist-info/RECORD,,