automatically size player on start
This commit is contained in:
@@ -4,10 +4,14 @@ var h = require('virtual-dom/h')
|
||||
|
||||
function Header (state, dispatch) {
|
||||
return h('.header', [
|
||||
h('.title', state.title),
|
||||
h('.title', state.view.title),
|
||||
h('.nav.left', [
|
||||
h('i.icon.back.disabled', 'chevron_left'),
|
||||
h('i.icon.forward', 'chevron_right')
|
||||
h('i.icon.back', {
|
||||
onclick: onBack
|
||||
}, 'chevron_left'),
|
||||
h('i.icon.forward', {
|
||||
onclick: onForward
|
||||
}, 'chevron_right')
|
||||
]),
|
||||
(function () {
|
||||
if (state.player !== 'local') {
|
||||
@@ -20,6 +24,14 @@ function Header (state, dispatch) {
|
||||
})()
|
||||
])
|
||||
|
||||
function onBack (e) {
|
||||
dispatch('back')
|
||||
}
|
||||
|
||||
function onForward (e) {
|
||||
dispatch('forward')
|
||||
}
|
||||
|
||||
function onAddTorrent (e) {
|
||||
var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4'
|
||||
dispatch('addTorrent', torrentId)
|
||||
|
||||
@@ -7,15 +7,18 @@ function Player (state, dispatch) {
|
||||
h('video', {
|
||||
src: state.server.localURL,
|
||||
autoplay: true,
|
||||
controls: true
|
||||
}),
|
||||
h('a.close', {
|
||||
onclick: closePlayer
|
||||
}, 'Close')
|
||||
controls: true,
|
||||
onplaying: onPlaying
|
||||
})
|
||||
])
|
||||
|
||||
function closePlayer () {
|
||||
dispatch('closePlayer')
|
||||
function onPlaying (e) {
|
||||
var video = e.target
|
||||
var dimensions = {
|
||||
width: video.videoWidth,
|
||||
height: video.videoHeight
|
||||
}
|
||||
dispatch('setDimensions', dimensions)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ function TorrentList (state, dispatch) {
|
||||
onclick: openPlayer
|
||||
}, 'play_arrow'),
|
||||
(function () {
|
||||
if (state.chromecast) {
|
||||
if (state.view.chromecast) {
|
||||
return h('i.btn.icon.chromecast', {
|
||||
className: !torrent.ready ? 'disabled' : '',
|
||||
onclick: openChromecast
|
||||
@@ -35,7 +35,7 @@ function TorrentList (state, dispatch) {
|
||||
}
|
||||
})(),
|
||||
(function () {
|
||||
if (state.airplay) {
|
||||
if (state.view.airplay) {
|
||||
return h('i.btn.icon.airplay', {
|
||||
className: !torrent.ready ? 'disabled' : '',
|
||||
onclick: openAirplay
|
||||
|
||||
Reference in New Issue
Block a user