import { Router } from 'express';
import { streamVideo } from '../services/streaming';

const router = Router();

router.get('/:videoId', async (req, res) => {
  try {
    await streamVideo(req, res);
  } catch (err) {
    if (!res.headersSent) {
      res.status(500).json({ error: 'Streaming error' });
    }
  }
});

export default router;
