APP_TOKEN_FILE = "client_secret.json"USER_TOKEN_FILE = "user_token.json"SCOPES = ['https://www.googleapis.com/auth/youtube.force-ssl','https://www.googleapis.com/auth/userinfo.profile',]def get_creds_cons():#hidedef get_creds_saved():#hidedef get_service(): # Get YouTube API service using credentials creds = get_creds_saved() service = build('youtube', 'v3', credentials=creds) return servicedef create_live_stream(title, description): service = get_service() scheduled_start_time = datetime.datetime.utcnow().isoformat() request = service.liveBroadcasts().insert( part="snippet,status", body={"snippet": {"title": title,"description": description,"scheduledStartTime": scheduled_start_time, },"status": {"privacyStatus": "private","lifeCycleStatus": "liveStarting", "selfDeclaredMadeForKids": False } } ) response = request.execute() return response['id']def stream_video(video_path, stream_key):#hideif __name__ == '__main__': print("** Hello, Azzrael_YT subscribers!!!\n") create_live_stream("tittle", "description") # Stream video video_path = "C:/Users/admin/PycharmProjects/pythonProject/video.mp4" # Update this with your video file path stream_key = 'dh9z-jtkx-wbq3-6wvp-2tac' # Replace with your YouTube stream key video_thread = threading.Thread(target=stream_video, args=(video_path, stream_key)) video_thread.start()
I'm trying to create a broadcast with requests and connect it to the video stream, everything works fine, except that the broadcast does not want to switch from the upcoming mode to the live mode and be broadcast, everything else works for video and sound transmission, and more, what could be the problem?