Parsing Twitch API and Youtube API

Hi, is there any possible ways to parse two API? where in if I input a twitch channel it will play twitch live, and when youtube embed code it will play youtube? on a single text field and 1 database value? here is the code for the html:

<input type ="text" name='stream' id="stream" class='form-control' value="{{$match->;stream}}" style="width: 45%;"/ >
<button id="editStreamBtn" type="button" onClick="changeChannel(document.getElementById('stream').value)" class="btn btn-success" data-edit-text="Update">Update</button>

for the player:

<div id ="player" value ='{{$match-&gt;stream}}' />

and here is for the twitch script

   <script type ="text/javascript">
  var options = {
        width: 700,
        height: 480,
        layout: "video",
        channel: '{{$match->stream}}',
        autoplay: true
        };
        var embed = new Twitch.Player("player", options);	  
        changeChannel = (chan) => {
        embed.setChannel(chan);
        }

and this is for the youtube script

 var tag = document.createElement('script');

  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  // 3. This function creates an <iframe> (and YouTube player)
  //    after the API code downloads.
  var player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      height: '390',
      width: '640',
      videoId: '$match->stream',
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange
      }
    });
  }

  // 4. The API will call this function when the video player is ready.
  function onPlayerReady(event) {
    event.target.playVideo();
  }

  // 5. The API calls this function when the player's state changes.
  //    The function indicates that when playing a video (state=1),
  //    the player should play for six seconds and then stop.
  var done = false;
  function onPlayerStateChange(event) {
    if (event.data == YT.PlayerState.PLAYING && !done) {
      setTimeout(stopVideo, 6000);
      done = true;
    }
  }
  function stopVideo() {
    player.stopVideo();
  }

is there any possible ways to parse these two? TYIA! btw, I haven’t added a changeChannel funct on yt, but I was just wondering if its possible same as the twitch script

No idea. This is the support forum for the TwitchAPI, can’t help you with the YouTube API.

It should be possible but I am not versed in the YouTube Live API, because this is the Twitch Third Party Developers forum