我正在使用Socket.io(Nodejs)和WebRTC创建视频流。我认为我所做的一切都正确,但本地流甚至都没有显示(都不是远程的)。我正在用这段代码实现我想要的
#Libraries
import io, json, codecs
import pyodbc
import logging
import os
import cloudstorage as gcs
import gcloud
from gcloud import storage
from google.cloud import bigquery
import pandas as pd
from gcloud.bigquery import SchemaField
import os
from googleapiclient import discovery
#Path variable
try:
script_path = os.path.dirname(os.path.abspath(__file__)) + "/"
except:
script_path = "C:\\Users\\userl\\Documents\\auth.json"
#Bigquery Credentials and settings
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = script_path
db = pyodbc.connect("DRIVER={SQL Server};server=10.0.1.1;database=blablabla;uid=xpto;pwd=xxx")
cursor = db.cursor()
SQLview = 'select * from test'
result = cursor.execute(SQLview)
items = [dict(zip([key[0] for key in cursor.description], row)) for row in result]
json_file = json.dumps(items, ensure_ascii=False).encode('utf-8')
client = storage.Client(project='big-data')
bucket = client.get_bucket('big-data-bkt')
blob = bucket.blob(json_file)
with open('dict_obj.json', 'rb') as f:
blob.upload_from_file(f)
这是服务器端代码:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.widgets import Slider
import numpy as np
fig = plt.figure(figsize=(10,6))
ax = fig.gca(projection='3d')
plt.subplots_adjust(bottom=0.15)
ax.set_xlim3d(-1, 1)
ax.set_ylim3d(-1, 1)
ax.set_zlim3d(-1, 1)
pos = [0.0, 0.0, 0.0]
V_ini = [0.5, 0.0, 0.0]
V = ax.quiver(*pos, *V_ini, length=1, normalize=False, color='green')
# SLIDER POSITIONS ON FIGURE
axcolor = 'lightgoldenrodyellow'
axVx = plt.axes([0.1, 0.11, 0.15, 0.02], facecolor=axcolor)
axVy = plt.axes([0.1, 0.08, 0.15, 0.02], facecolor=axcolor)
axVz = plt.axes([0.1, 0.05, 0.15, 0.02], facecolor=axcolor)
# SLIDER PROPERTIES
sliderVx = Slider(axVx, 'Vx', -1, 1, valinit=V_ini[0], valstep=0.01)
sliderVy = Slider(axVy, 'Vy', -1, 1, valinit=V_ini[1], valstep=0.01)
sliderVz = Slider(axVz, 'Vz', -1, 1, valinit=V_ini[2], valstep=0.01)
# QUIVER TO SEGMENT CONVERTER
def q2s(X, Y, Z, u, v, w, length=1):
segments = (X, Y, Z, X+u*length, Y+v*length, Z+w*length)
segments = np.array(segments).reshape(6,-1)
return [[[x, y, z], [u, v, w]] for x, y, z, u, v, w in zip(*list(segments))]
def update(val):
V_ = (sliderVx.val, sliderVy.val, sliderVz.val)
V.set_segments(q2s(*pos, *V_))
sliderVx.on_changed(update)
sliderVy.on_changed(update)
sliderVz.on_changed(update)
plt.show()
控制台很清楚,但是仍然无法正常工作。 那是什么问题呢?我该如何解决呢? 谢谢!