| 371 | } |
| 372 | |
| 373 | bool VideoNode::init() { |
| 374 | if (!Sprite::init()) return false; |
| 375 | |
| 376 | auto videoData = std::make_shared<VideoData>(); |
| 377 | _videoData = videoData; |
| 378 | videoData->looped = _looped; |
| 379 | if (!videoData->init(_filename)) { |
| 380 | return false; |
| 381 | } |
| 382 | |
| 383 | setSize({s_cast<float>(videoData->videoWidth), |
| 384 | s_cast<float>(videoData->videoHeight)}); |
| 385 | |
| 386 | _thread = New<Async>(); |
| 387 | _thread->run([videoData]() { |
| 388 | while (!videoData->stoped) { |
| 389 | videoData->readFileChunk(); |
| 390 | } |
| 391 | }); |
| 392 | |
| 393 | scheduleUpdate(); |
| 394 | return true; |
| 395 | } |
| 396 | |
| 397 | void VideoNode::cleanup() { |
| 398 | cleanupResources(); |
nothing calls this directly
no test coverage detected