React-TV ๐บ โข
![PRs Welcome](https://camo.githubusercontent.com/d88d8d77fa79e828eea397f75a1ebd114d13488aeec4747477ffbd2274de95ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e737667)
A
react-DOM
like for low memory applications and packager for TV as platform.
import React from 'react'
import ReactTV, { Platform } from 'ReactTV'
class Clock extends React.Component {
state = { date: new Date() }
componentDidMount() {
setInterval(() => this.setState({date: new Date()}), 1000)
}
render() {
if (Platform('webos')) {
return (
<h1>Time is {this.state.date.toLocaleTimeString()}</h1>
)
}
return <h2>This App is available only at LG WebOS</h2>
}
}
ReactTV.render(<Clock/>, document.getElementById('root'))
React-TV is a ecosystem for React Application for TVs (from the renderer to CLI for pack/build applications) focused now on WebOS and SmartTV.
The mission of React-TV is build & develop fast for TVs.
tl;dr: Crafting a high-performance TV user interface using React
Crafting a high-performance TV user interface using React is a real challenge, because of some reasons:
- Limited graphics acceleration
- Single core CPUs
- High Memory Usage for a commom TV App
These restrictions make super responsive 60fps experiences especially tricky. The strategy is step in the renderer: Applying reactive concepts to unblock the processing on renderer layer, plug the TV's keyListener, avoid React.createElement (which cost a lot)[...]
In addition: Unify the build for multiple TV platforms.
To install react-tv
as a CLI:
$ npm install -g react-tv
# or
$ yarn global add react-tv
To install react-tv
as a Module:
$ npm install react-tv --save
# or
$ yarn add react-tv
import React from 'react'
import ReactTV, { Platform } from 'react-tv'
class Clock extends React.Component {
constructor() {
super()
this.state = { date: new Date() }
}
render() {
let currentPlatform = 'Browser'
if (Platform('webos'))
currentPlatform = 'LG WebOS'
return (
<div class='container'>
<img src='https://i.imgur.com/9yhDR0Q.png'/>
<h1>It's {this.state.date.toLocaleTimeString()}</h1>
<p>You're in {currentPlatform}</p>
</div>
)
}
}
ReactTV.render(<Clock/>, document.getElementById('root'))
Generate react-tv projects:
$ react-tv init <app-name>
If you want to specify app path on commnand:
$ react-tv init <app-name> <app-path>
Open app folder:
$ cd app-name
Run emulator and devices (should pack, build and run on emulator):
$ react-tv run-webos
Run only on devices and disable create/call Emulator instance:
$ react-tv run-webos --disable-emulator
Run webos app on browser (developer mode on browser). run-webos-dev
is using REACT_TV_PORT
environment variable or 8500
as port number.
$ react-tv run-webos-dev
When building a cross-platform tv app, you'll want to re-use as much code as possible. Scenarios may arise where it makes sense for the code to be different, for example you may want to implement separate visual components for LG-WebOS
and Samsung-Tizen
.
React-TV provides Platform
module to easily organize your code and separate it by platform:
import { Platform } from 'react-tv'
console.log(Platform('webos')) // true
console.log(Platform('tizen')) // false
console.log(Platform('orsay')) // false
- Keys
import { Keys } from 'react-tv'
<Keys onChange={myCustomHandler}/>
Target Version: 3.0
WebOS, also known as Open WebOS or LG WebOS, (previously known as HP WebOS and Palm WebOS, stylized as webOS) is a Linux kernel-based multitasking operating system for smart devices such as Smart TVs and it has been used as a mobile operating system.
[Work in Progress]
[Work in Progress]
- http://webostv.developer.lge.com/sdk/download/download-sdk/
- http://webostv.developer.lge.com/sdk/install-instructions/installing-sdk/
- http://webostv.developer.lge.com/sdk/emulator/introduction-emulator/
- http://webostv.developer.lge.com/develop/building-your-first-web-app-webos-tv/
- http://webostv.developer.lge.com/develop/app-test/
- http://webostv.developer.lge.com/api/web-api/supported-standard-web-api/
- http://developer.samsung.com/tv/develop/getting-started/setup-sdk/installing-tv-sdk/
- http://developer.samsung.com/tv/develop/getting-started/using-sdk/tv-simulator
- http://developer.samsung.com/tv/develop/getting-started/essentials-for-beginner
- https://github.com/ruiposse/smart-tv-app-dev-guidelines
- https://github.com/immosmart/smartbox
- https://github.com/linuxenko/awesome-smarttv
- https://github.com/reactjs/react-basic
- https://github.com/iamdustan/tiny-react-renderer
- https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html
See ReactTV's Changelog.
Currently ReactTV is licensed by MIT License
Thanks react-dom for be example and a inspiration code :)
Initial proof-of-concept. [IN PROGRESS]
- CLI Build Abstraction of LG Webos (
run-webos
,run-webos-dev
) - Create a guide or script to Install all LG WebOS environment
- Renderer ReactElements to simple DOM
- Support HOF and HOC
- Support State and Lifecycle
- Check
webos
Platform - Migrate to
React-Reconciler
Implement essential functionality needed for daily use by early adopters.
- Support render to Canvas instead DOM using
React.CanvasComponent
-
run-webos
support TV device as param - Start CLI for Tizen
- Develop helpers for WebOS debbug (e.g: Log System).
- Support Cross Platform
- Check executable bin path for Windows, OSX and Linux
- Bind TV key listeners on
React.Element
- Benchmark it
Add additional features users expect from a Renderer. Then fix bugs and stabilize through continuous daily use. At this point we can start to experiment with innovative ideas and paradigms.
- Start CLI for Orsay
- Update Benchmarks
- Handle common errors
- Reactive Renderer
- Testing and stability