Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mark committed Mar 29, 2023
1 parent b6aa8b1 commit d76d37f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/views/ConnectionForm/EmbedSample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ export default function EmbedSample({ config }: Props) {
const preview = `
import "rsuite/dist/rsuite.min.css";
import { Button } from "rsuite";
import { MetaProvider, MetaEditor, Hooks } from "pixel-streaming";
import { MetaProvider, MetaEditor, Hooks, IApplication } from "pixel-streaming";
const PlayerView = () => {
const refPlayer = React.useRef(null)
const { emitUi } = Hooks.actions();
return (
<MetaEditor
ref={refPlayer}
debugMode="${config.debugMode}"
showToolbar={${config.showToolbar}}
onLoad={(app: IApplication) => {
console.log('@'.repeat(30))
console.log('app', app)
}}
psHost="${decodeURIComponent(config.psHost)}"
psConfig={${JSON.stringify(config.psConfig, null, 4).replace(/(?:\r\n|\r|\n)/g, '\n ')}}>
<Button onClick={() => emitUi({ action: "ui_command" })}>
Expand Down
16 changes: 15 additions & 1 deletion src/views/Player/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as React from 'react';

// libs
import "rsuite/dist/rsuite.min.css";
import { MetaProvider, MetaEditor, PlayerConfigProps } from 'pixel-streaming'
import type { IApplication } from 'pixel-streaming'

// layouts
import UserBar from './UserBar'
Expand All @@ -19,16 +22,27 @@ interface Props {

const PlayerView = ({ config }: Props) => {

const refPlayer = React.useRef(null)

const newConfig: PlayerConfigProps = {
...defaultConfig,
...config,
}

// alert(JSON.stringify(newConfig, null, 2))

const handleLoad = (app: IApplication) => {
console.log('@'.repeat(30))
console.log('app', app)
console.log(refPlayer.current)
}

return (
<>
<MetaEditor {...newConfig}>
<MetaEditor
{...newConfig}
ref={refPlayer}
onLoad={handleLoad}>
<>
<Preloader />
<UserBar />
Expand Down

0 comments on commit d76d37f

Please sign in to comment.