/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package clientetv;

import java.awt.Canvas;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
import uk.co.caprica.vlcj.player.embedded.videosurface.CanvasVideoSurface;


public class ClienteTV {

     private String mrl;
     private MediaPlayerFactory mediaPlayerFactory;
     private EmbeddedMediaPlayer mediaPlayer;
     private Canvas canvas;
     private CanvasVideoSurface videoSurface;
     private JFrame f;
     
     public ClienteTV(String media){
         mrl=media;
         canvas = new Canvas();
         canvas.setBackground(Color.black);
         mediaPlayerFactory = new MediaPlayerFactory();
         mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();
         videoSurface = mediaPlayerFactory.newVideoSurface(canvas);
         mediaPlayer.setVideoSurface(videoSurface);
         f = new JFrame("TV");
         f.add(canvas);
         f.setSize(800, 600);
         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         f.setVisible(true);
     }
     
     public void changeChannel(String media){
         mrl = media;
         mediaPlayer.stop();
         mediaPlayer.playMedia(mrl);
     }
     public void Play(){
         mediaPlayer.playMedia(mrl);
     }
     public void setVol(int vol){
         mediaPlayer.setVolume(vol);
         System.out.println(vol);
     }
     public void Stop(){
         mediaPlayer.stop();
     }
}
