Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ lib/
.builderrc
.eslintrc
.npmignore
.editorconfig
.eslintignore
.prettierrc
.circleci
.github

# demo folder has special meaning in R
# this should hopefully make it still
Expand All @@ -15,14 +20,15 @@ demo/.*\.js
demo/.*\.html
demo/.*\.css

# ignore python files/folders
# ignore Python files/folders
setup.py
usage.py
setup.py
index.py
config.py
requirements.txt
MANIFEST.in
CHANGELOG.md
tests/
.pylintrc
test/
# CRAN has weird LICENSE requirements
LICENSE.txt
^.*\.Rproj$
^\.Rproj\.user$
18 changes: 9 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Package: dashPlayer
Title: Dash player component for videos
Version: 0.0.1
Authors @R: as.person(c(Xing Han Lu <xinghan@plot.ly>))
Description: Dash player component for videos
Title: Interactive Media Player Component for Dash

Version: 0.0.2
Description: Dash Player is a dash component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, and DailyMotion. It is wrapped around the react-player component.

Depends: R (>= 3.0.2)
Imports:
dash (>= 0.1.0)
Suggests:
Authors@R: person("Xing", "Lu", role = c("aut", "cre"), email = "xinghan@plot.ly")
License: MIT + file LICENSE
URL: https://github.com/plotly/dash-html-components
BugReports: https://github.com/plotly/dash-html-components/issues
URL: https://github.com/plotly/dash-player
BugReports: https://github.com/plotly/dash-player/issues
Encoding: UTF-8
LazyData: true
Author: Xing Han Lu [aut]
Maintainer: Ryan Patrick Kyle <ryan@plot.ly>
KeepSource: true
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AUTO GENERATED FILE - DO NOT EDIT

export(dashPlayer)
import(dash)
export(DashPlayer)
export(dashPlayer)
7 changes: 4 additions & 3 deletions R/dashPlayer.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# AUTO GENERATED FILE - DO NOT EDIT

dashPlayer <- function(id=NULL, url=NULL, playing=NULL, loop=NULL, controls=NULL, volume=NULL, muted=NULL, playbackRate=NULL, width=NULL, height=NULL, style=NULL, playsinline=NULL, currentTime=NULL, secondsLoaded=NULL, duration=NULL, intervalCurrentTime=NULL, intervalSecondsLoaded=NULL, intervalDuration=NULL, seekTo=NULL) {
#' @export
dashPlayer <- function(id=NULL, className=NULL, controls=NULL, currentTime=NULL, duration=NULL, height=NULL, intervalCurrentTime=NULL, intervalDuration=NULL, intervalSecondsLoaded=NULL, loop=NULL, muted=NULL, playbackRate=NULL, playing=NULL, playsinline=NULL, secondsLoaded=NULL, seekTo=NULL, style=NULL, url=NULL, volume=NULL, width=NULL) {

props <- list(id=id, url=url, playing=playing, loop=loop, controls=controls, volume=volume, muted=muted, playbackRate=playbackRate, width=width, height=height, style=style, playsinline=playsinline, currentTime=currentTime, secondsLoaded=secondsLoaded, duration=duration, intervalCurrentTime=intervalCurrentTime, intervalSecondsLoaded=intervalSecondsLoaded, intervalDuration=intervalDuration, seekTo=seekTo)
props <- list(id=id, className=className, controls=controls, currentTime=currentTime, duration=duration, height=height, intervalCurrentTime=intervalCurrentTime, intervalDuration=intervalDuration, intervalSecondsLoaded=intervalSecondsLoaded, loop=loop, muted=muted, playbackRate=playbackRate, playing=playing, playsinline=playsinline, secondsLoaded=secondsLoaded, seekTo=seekTo, style=style, url=url, volume=volume, width=width)
if (length(props) > 0) {
props <- props[!vapply(props, is.null, logical(1))]
}
component <- list(
props = props,
type = 'DashPlayer',
namespace = 'dash_player',
propNames = c('id', 'url', 'playing', 'loop', 'controls', 'volume', 'muted', 'playbackRate', 'width', 'height', 'style', 'playsinline', 'currentTime', 'secondsLoaded', 'duration', 'intervalCurrentTime', 'intervalSecondsLoaded', 'intervalDuration', 'seekTo'),
propNames = c('id', 'className', 'controls', 'currentTime', 'duration', 'height', 'intervalCurrentTime', 'intervalDuration', 'intervalSecondsLoaded', 'loop', 'muted', 'playbackRate', 'playing', 'playsinline', 'secondsLoaded', 'seekTo', 'style', 'url', 'volume', 'width'),
package = 'dashPlayer'
)

Expand Down
27 changes: 8 additions & 19 deletions R/internal.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
.dashPlayer_js_metadata <- function() {
deps_metadata <- list(`dash_player` = structure(list(name = "dash_player",
version = "0.0.1", src = list(href = NULL,
version = "0.0.2", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'dash_player.min.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashPlayer",
all_files = FALSE), class = "html_dependency"))
all_files = FALSE), class = "html_dependency"),
`dash_player` = structure(list(name = "dash_player",
version = "0.0.2", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'dash_player.min.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashPlayer",
all_files = FALSE, dynamic = TRUE), class = "html_dependency"))
return(deps_metadata)
}

dash_assert_valid_wildcards <- function (attrib = list("data", "aria"), ...)
{
args <- list(...)
validation_results <- lapply(names(args), function(x) {
grepl(paste0("^", attrib, "-[a-zA-Z0-9]{1,}$", collapse = "|"),
x)
})
if (FALSE %in% validation_results) {
stop(sprintf("The following wildcards are not currently valid in Dash: '%s'",
paste(names(args)[grepl(FALSE, unlist(validation_results))],
collapse = ", ")), call. = FALSE)
}
else {
return(args)
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To generate builds manually, run the following:

```sh
$ npm install webpack webpack-cli
$ npm run build:all
$ npm run build
```

## Usage
Expand Down
197 changes: 65 additions & 132 deletions dash_player/DashPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,161 +5,94 @@

class DashPlayer(Component):
"""A DashPlayer component.
A Dash component for playing a variety of URLs, including file paths,
YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud,
and DailyMotion.
A Dash component for playing a variety of URLs, including file paths,
YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud,
and DailyMotion.

Keyword arguments:
Keyword arguments:

- id (string; optional):
The ID used to identify this component in Dash callbacks.
- id (string; optional):
The ID used to identify this component in Dash callbacks.

- className (string; optional):
The CSS class used to identify this component in Dash callbacks.
- className (string; optional):
Used to identify the CSS class of the Dash Player component.

- controls (boolean; default False):
Set to True or False to display native player controls Vimeo,
Twitch and Wistia player will always display controls.
- controls (boolean; default False):
Set to True or False to display native player controls Vimeo,
Twitch and Wistia player will always display controls.

- currentTime (number; optional):
Returns the number of seconds that have been played.
- currentTime (number; optional):
Returns the number of seconds that have been played.

- duration (number; optional):
Returns the duration (in seconds) of the currently playing media.
- duration (number; optional):
Returns the duration (in seconds) of the currently playing media.

- height (string; default '360px'):
A number or string representing the pixel height of the player.
- height (string; default '360px'):
A number or string representing the pixel height of the player.

- intervalCurrentTime (number; default 100):
Interval in milliseconds at which currenTtime prop is updated.
- intervalCurrentTime (number; default 100):
Interval in milliseconds at which currenTtime prop is updated.

- intervalDuration (number; default 500):
Interval in milliseconds at which duration prop is updated.
- intervalDuration (number; default 500):
Interval in milliseconds at which duration prop is updated.

- intervalSecondsLoaded (number; default 500):
Interval in milliseconds at which secondsLoaded prop is updated.
- intervalSecondsLoaded (number; default 500):
Interval in milliseconds at which secondsLoaded prop is updated.

- loop (boolean; default False):
Whether or not the media will loop once the player reaches the
end. Can be set to True or False to set looping on or off,
respectively.
- loop (boolean; default False):
Whether or not the media will loop once the player reaches the
end. Can be set to True or False to set looping on or off,
respectively.

- muted (boolean; default False):
Set to True or False to mute or unmute player volume,
respectively. Only works if volume is set.
- muted (boolean; default False):
Set to True or False to mute or unmute player volume,
respectively. Only works if volume is set.

- playbackRate (number; default 1):
Set the playback rate of the player Only supported by YouTube,
Wistia, and file paths.
- playbackRate (number; default 1):
Set the playback rate of the player Only supported by YouTube,
Wistia, and file paths.

- playing (boolean; default False):
Whether or not the media is currently playing. Can be set to True
or False to play and pause the media, respectively.
- playing (boolean; default False):
Whether or not the media is currently playing. Can be set to True
or False to play and pause the media, respectively.

- playsinline (boolean; default False):
Applies the html5 playsinline attribute where supported, which
allows videos to be played inline and will not automatically enter
fullscreen mode when playback begins (for iOS).
- playsinline (boolean; default False):
Applies the html5 playsinline attribute where supported, which
allows videos to be played inline and will not automatically enter
fullscreen mode when playback begins (for iOS).

- secondsLoaded (number; optional):
Returns the number of seconds that have been loaded.
- secondsLoaded (number; optional):
Returns the number of seconds that have been loaded.

- seekTo (number; optional):
Seek to the given number of seconds, or fraction if amount is
between 0 and 1.
- seekTo (number; optional):
Seek to the given number of seconds, or fraction if amount is
between 0 and 1.

- style (dict; optional):
Optional additional CSS styles. If width or height are supplied
within style, then this will override the component-level width or
height.
- style (dict; optional):
Optional additional CSS styles. If width or height are supplied
within style, then this will override the component-level width or
height.

- url (string; optional):
The url of the media to be played.
- url (string; optional):
The url of the media to be played.

- volume (number; optional):
A number between 0 and 1 representing the volume of the player. If
set to None, Dash Player ises default volume on all players.

- width (string; default '640px'):
A number or string representing the pixel width of the player."""
- volume (number; optional):
A number between 0 and 1 representing the volume of the player. If
set to None, Dash Player ises default volume on all players.

- width (string; default '640px'):
A number or string representing the pixel width of the player."""
_children_props = []
_base_nodes = ["children"]
_namespace = "dash_player"
_type = "DashPlayer"

_base_nodes = ['children']
_namespace = 'dash_player'
_type = 'DashPlayer'
@_explicitize_args
def __init__(
self,
id=Component.UNDEFINED,
className=Component.UNDEFINED,
url=Component.UNDEFINED,
playing=Component.UNDEFINED,
loop=Component.UNDEFINED,
controls=Component.UNDEFINED,
volume=Component.UNDEFINED,
muted=Component.UNDEFINED,
playbackRate=Component.UNDEFINED,
width=Component.UNDEFINED,
height=Component.UNDEFINED,
style=Component.UNDEFINED,
playsinline=Component.UNDEFINED,
currentTime=Component.UNDEFINED,
secondsLoaded=Component.UNDEFINED,
duration=Component.UNDEFINED,
intervalCurrentTime=Component.UNDEFINED,
intervalSecondsLoaded=Component.UNDEFINED,
intervalDuration=Component.UNDEFINED,
seekTo=Component.UNDEFINED,
**kwargs
):
self._prop_names = [
"id",
"className",
"controls",
"currentTime",
"duration",
"height",
"intervalCurrentTime",
"intervalDuration",
"intervalSecondsLoaded",
"loop",
"muted",
"playbackRate",
"playing",
"playsinline",
"secondsLoaded",
"seekTo",
"style",
"url",
"volume",
"width",
]
self._valid_wildcard_attributes = []
self.available_properties = [
"id",
"className",
"controls",
"currentTime",
"duration",
"height",
"intervalCurrentTime",
"intervalDuration",
"intervalSecondsLoaded",
"loop",
"muted",
"playbackRate",
"playing",
"playsinline",
"secondsLoaded",
"seekTo",
"style",
"url",
"volume",
"width",
]
self.available_wildcard_properties = []
_explicit_args = kwargs.pop("_explicit_args")
def __init__(self, id=Component.UNDEFINED, className=Component.UNDEFINED, url=Component.UNDEFINED, playing=Component.UNDEFINED, loop=Component.UNDEFINED, controls=Component.UNDEFINED, volume=Component.UNDEFINED, muted=Component.UNDEFINED, playbackRate=Component.UNDEFINED, width=Component.UNDEFINED, height=Component.UNDEFINED, style=Component.UNDEFINED, playsinline=Component.UNDEFINED, currentTime=Component.UNDEFINED, secondsLoaded=Component.UNDEFINED, duration=Component.UNDEFINED, intervalCurrentTime=Component.UNDEFINED, intervalSecondsLoaded=Component.UNDEFINED, intervalDuration=Component.UNDEFINED, seekTo=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'className', 'controls', 'currentTime', 'duration', 'height', 'intervalCurrentTime', 'intervalDuration', 'intervalSecondsLoaded', 'loop', 'muted', 'playbackRate', 'playing', 'playsinline', 'secondsLoaded', 'seekTo', 'style', 'url', 'volume', 'width']
self._valid_wildcard_attributes = []
self.available_properties = ['id', 'className', 'controls', 'currentTime', 'duration', 'height', 'intervalCurrentTime', 'intervalDuration', 'intervalSecondsLoaded', 'loop', 'muted', 'playbackRate', 'playing', 'playsinline', 'secondsLoaded', 'seekTo', 'style', 'url', 'volume', 'width']
self.available_wildcard_properties = []
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs and excess named props
args = {k: _locals[k] for k in _explicit_args}
Expand Down
2 changes: 1 addition & 1 deletion dash_player/dash_player.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_player/dash_player.min.js.map

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions dash_player/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "dash-player",
"name": "@plotly/dash-player",
"version": "0.0.2",
"description": "Dash player component for videos",
"repository": {
Expand All @@ -22,10 +22,8 @@
"validate-init": "python _validate_init.py",
"build:js-dev": "webpack",
"build:js": "webpack",
"build:py": "dash-generate-components ./src/lib/components dash-player",
"build:py-activated": "(. venv/bin/activate || venv\\scripts\\activate && npm run build:py)",
"build:all": "npm run build:js && npm run build:js-dev && npm run build:py",
"build:all-activated": "(. venv/bin/activate || venv\\scripts\\activate && npm run build:all)"
"build:backends": "dash-generate-components ./src/lib/components dash-player --r-prefix ''",
"build": "npm run build:js && npm run build:js-dev && npm run build:backends"
},
"devDependencies": {
"@babel/core": "^7.19.1",
Expand Down
3 changes: 2 additions & 1 deletion inst/deps/dash_player.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions inst/deps/dash_player.min.js.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions man/dashPlayer-package.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
% Auto-generated: do not edit by hand
\docType{package}
\name{dashPlayer-package}
\alias{dashPlayer}
\title{Interactive Media Player Component for Dash
}
\description{
Dash Player is a dash component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, and DailyMotion. It is wrapped around the react-player component.

}
\author{
\strong{Maintainer}: Alex Hsu <alex.hsu@plot.ly>
}
Loading